diff mbox series

[net-next,01/22] can: at91_can: Convert to platform remove callback returning void

Message ID 20230515205759.1003118-2-mkl@pengutronix.de (mailing list archive)
State Accepted
Commit 03ef5a4b322f342453a135ca8f376c09fd379024
Delegated to: Netdev Maintainers
Headers show
Series [net-next,01/22] can: at91_can: Convert to platform remove callback returning void | expand

Checks

Context Check Description
netdev/series_format warning Pull request is its own cover letter; Series longer than 15 patches
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers warning 6 maintainers not CCed: nicolas.ferre@microchip.com alexandre.belloni@bootlin.com wg@grandegger.com linux-arm-kernel@lists.infradead.org pabeni@redhat.com edumazet@google.com
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Marc Kleine-Budde May 15, 2023, 8:57 p.m. UTC
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart from
emitting a warning) and this typically results in resource leaks. To improve
here there is a quest to make the remove callback return void. In the first
step of this quest all drivers are converted to .remove_new() which already
returns void. Eventually after all drivers are converted, .remove_new() is
renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230512212725.143824-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/at91_can.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)


base-commit: 0d9b41daa5907756a31772d8af8ac5ff25cf17c1

Comments

patchwork-bot+netdevbpf@kernel.org May 17, 2023, 4:10 a.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (main)
by Marc Kleine-Budde <mkl@pengutronix.de>:

On Mon, 15 May 2023 22:57:38 +0200 you wrote:
> From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart from
> emitting a warning) and this typically results in resource leaks. To improve
> here there is a quest to make the remove callback return void. In the first
> step of this quest all drivers are converted to .remove_new() which already
> returns void. Eventually after all drivers are converted, .remove_new() is
> renamed to .remove().
> 
> [...]

Here is the summary with links:
  - [net-next,01/22] can: at91_can: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/03ef5a4b322f
  - [net-next,02/22] can: bxcan: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/cba8ed7f0043
  - [net-next,03/22] can: c_can: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/1708caf4c47d
  - [net-next,04/22] can: usb: f81604: add Fintek F81604 support
    https://git.kernel.org/netdev/net-next/c/88da17436973
  - [net-next,05/22] can: cc770_isa: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/938100762293
  - [net-next,06/22] can: bxcan: Remove unnecessary print function dev_err()
    https://git.kernel.org/netdev/net-next/c/cca7d85ad80c
  - [net-next,07/22] can: cc770_platform: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/86eb8a19b477
  - [net-next,08/22] can: length: make header self contained
    https://git.kernel.org/netdev/net-next/c/6882011e8854
  - [net-next,09/22] can: ctucanfd: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/45413bf75919
  - [net-next,10/22] can: flexcan: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/55216590c9cf
  - [net-next,11/22] can: grcan: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/6aa62362f14d
  - [net-next,12/22] can: ifi_canfd: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/a5095a981018
  - [net-next,13/22] can: janz-ican3: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/3ac96f45aac6
  - [net-next,14/22] can: m_can: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/2d7c33d032ff
  - [net-next,15/22] can: mscan: mpc5xxx_can: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/36157299e67b
  - [net-next,16/22] can: rcar: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/ae08f87afff7
  - [net-next,17/22] can: sja1000_isa: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/0367b598afbe
  - [net-next,18/22] can: sja1000_platform: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/bc79adfbd1fd
  - [net-next,19/22] can: softing: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/737aec8a8f13
  - [net-next,20/22] can: sun4i_can: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/aaa278e646c0
  - [net-next,21/22] can: ti_hecc: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/9587b93b7755
  - [net-next,22/22] can: xilinx: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/0816e1dd5ea8

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 199cb200f2bd..4621266851ed 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1346,7 +1346,7 @@  static int at91_can_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int at91_can_remove(struct platform_device *pdev)
+static void at91_can_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct at91_priv *priv = netdev_priv(dev);
@@ -1362,8 +1362,6 @@  static int at91_can_remove(struct platform_device *pdev)
 	clk_put(priv->clk);
 
 	free_candev(dev);
-
-	return 0;
 }
 
 static const struct platform_device_id at91_can_id_table[] = {
@@ -1381,7 +1379,7 @@  MODULE_DEVICE_TABLE(platform, at91_can_id_table);
 
 static struct platform_driver at91_can_driver = {
 	.probe = at91_can_probe,
-	.remove = at91_can_remove,
+	.remove_new = at91_can_remove,
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.of_match_table = of_match_ptr(at91_can_dt_ids),