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

Bluetooth: btqcomsmd: 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 <u.kleine-koenig@pengutronix.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

authored by

Uwe Kleine-König and committed by
Luiz Augusto von Dentz
4a62832f 8c0401b7

+2 -4
+2 -4
drivers/bluetooth/btqcomsmd.c
··· 197 197 return ret; 198 198 } 199 199 200 - static int btqcomsmd_remove(struct platform_device *pdev) 200 + static void btqcomsmd_remove(struct platform_device *pdev) 201 201 { 202 202 struct btqcomsmd *btq = platform_get_drvdata(pdev); 203 203 ··· 206 206 207 207 rpmsg_destroy_ept(btq->cmd_channel); 208 208 rpmsg_destroy_ept(btq->acl_channel); 209 - 210 - return 0; 211 209 } 212 210 213 211 static const struct of_device_id btqcomsmd_of_match[] = { ··· 216 218 217 219 static struct platform_driver btqcomsmd_driver = { 218 220 .probe = btqcomsmd_probe, 219 - .remove = btqcomsmd_remove, 221 + .remove_new = btqcomsmd_remove, 220 222 .driver = { 221 223 .name = "btqcomsmd", 222 224 .of_match_table = btqcomsmd_of_match,