Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/surface: aggregator-cdev: Convert to platform remove callback returning void

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: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20230917203805.1149595-4-u.kleine-koenig@pengutronix.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Uwe Kleine-König and committed by
Hans de Goede
1cc995a6 342d7dce

+2 -3
+2 -3
drivers/platform/surface/surface_aggregator_cdev.c
··· 714 714 return 0; 715 715 } 716 716 717 - static int ssam_dbg_device_remove(struct platform_device *pdev) 717 + static void ssam_dbg_device_remove(struct platform_device *pdev) 718 718 { 719 719 struct ssam_cdev *cdev = platform_get_drvdata(pdev); 720 720 struct ssam_cdev_client *client; ··· 757 757 misc_deregister(&cdev->mdev); 758 758 759 759 ssam_cdev_put(cdev); 760 - return 0; 761 760 } 762 761 763 762 static struct platform_device *ssam_cdev_device; 764 763 765 764 static struct platform_driver ssam_cdev_driver = { 766 765 .probe = ssam_dbg_device_probe, 767 - .remove = ssam_dbg_device_remove, 766 + .remove_new = ssam_dbg_device_remove, 768 767 .driver = { 769 768 .name = SSAM_CDEV_DEVICE_NAME, 770 769 .probe_type = PROBE_PREFER_ASYNCHRONOUS,