Skip to content

Commit 9688b1d

Browse files
Uwe Kleine-Königchanwoochoi
authored andcommitted
extcon: max77843: 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. Link: https://lore.kernel.org/lkml/30097beba928bf2073645f85d21fb9c1aee64991.1708876186.git.u.kleine-koenig@pengutronix.de/ Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Chanwoo Choi <[email protected]>
1 parent ba6985e commit 9688b1d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/extcon/extcon-max77843.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -928,16 +928,14 @@ static int max77843_muic_probe(struct platform_device *pdev)
928928
return ret;
929929
}
930930

931-
static int max77843_muic_remove(struct platform_device *pdev)
931+
static void max77843_muic_remove(struct platform_device *pdev)
932932
{
933933
struct max77843_muic_info *info = platform_get_drvdata(pdev);
934934
struct max77693_dev *max77843 = info->max77843;
935935

936936
cancel_work_sync(&info->irq_work);
937937
regmap_del_irq_chip(max77843->irq, max77843->irq_data_muic);
938938
i2c_unregister_device(max77843->i2c_muic);
939-
940-
return 0;
941939
}
942940

943941
static const struct platform_device_id max77843_muic_id[] = {
@@ -958,7 +956,7 @@ static struct platform_driver max77843_muic_driver = {
958956
.of_match_table = of_max77843_muic_dt_match,
959957
},
960958
.probe = max77843_muic_probe,
961-
.remove = max77843_muic_remove,
959+
.remove_new = max77843_muic_remove,
962960
.id_table = max77843_muic_id,
963961
};
964962

0 commit comments

Comments
 (0)