Skip to content

Commit ea4bad2

Browse files
Uwe Kleine-KönigTzung-Bi Shih
authored andcommitted
platform/chrome: cros_typec_switch: 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() will be 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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Tzung-Bi Shih <[email protected]>
1 parent 58b1519 commit ea4bad2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/platform/chrome/cros_typec_switch.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,11 @@ static int cros_typec_switch_probe(struct platform_device *pdev)
297297
return cros_typec_register_switches(sdata);
298298
}
299299

300-
static int cros_typec_switch_remove(struct platform_device *pdev)
300+
static void cros_typec_switch_remove(struct platform_device *pdev)
301301
{
302302
struct cros_typec_switch_data *sdata = platform_get_drvdata(pdev);
303303

304304
cros_typec_unregister_switches(sdata);
305-
return 0;
306305
}
307306

308307
#ifdef CONFIG_ACPI
@@ -319,7 +318,7 @@ static struct platform_driver cros_typec_switch_driver = {
319318
.acpi_match_table = ACPI_PTR(cros_typec_switch_acpi_id),
320319
},
321320
.probe = cros_typec_switch_probe,
322-
.remove = cros_typec_switch_remove,
321+
.remove_new = cros_typec_switch_remove,
323322
};
324323

325324
module_platform_driver(cros_typec_switch_driver);

0 commit comments

Comments
 (0)