Skip to content

Commit 1cc995a

Browse files
Uwe Kleine-Königjwrdegoede
authored andcommitted
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>
1 parent 342d7dc commit 1cc995a

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/platform/surface/surface_aggregator_cdev.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ static int ssam_dbg_device_probe(struct platform_device *pdev)
714714
return 0;
715715
}
716716

717-
static int ssam_dbg_device_remove(struct platform_device *pdev)
717+
static void ssam_dbg_device_remove(struct platform_device *pdev)
718718
{
719719
struct ssam_cdev *cdev = platform_get_drvdata(pdev);
720720
struct ssam_cdev_client *client;
@@ -757,14 +757,13 @@ static int ssam_dbg_device_remove(struct platform_device *pdev)
757757
misc_deregister(&cdev->mdev);
758758

759759
ssam_cdev_put(cdev);
760-
return 0;
761760
}
762761

763762
static struct platform_device *ssam_cdev_device;
764763

765764
static struct platform_driver ssam_cdev_driver = {
766765
.probe = ssam_dbg_device_probe,
767-
.remove = ssam_dbg_device_remove,
766+
.remove_new = ssam_dbg_device_remove,
768767
.driver = {
769768
.name = SSAM_CDEV_DEVICE_NAME,
770769
.probe_type = PROBE_PREFER_ASYNCHRONOUS,

0 commit comments

Comments
 (0)