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

ALSA: sh_dac_audio: 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 (mostly) ignored
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.

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>
Acked-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Link: https://lore.kernel.org/r/20230315150745.67084-13-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Uwe Kleine-König and committed by
Mark Brown
a0f4aa0a de0f49b8

+2 -3
+2 -3
sound/sh/sh_dac_audio.c
··· 257 257 258 258 259 259 /* driver .remove -- destructor */ 260 - static int snd_sh_dac_remove(struct platform_device *devptr) 260 + static void snd_sh_dac_remove(struct platform_device *devptr) 261 261 { 262 262 snd_card_free(platform_get_drvdata(devptr)); 263 - return 0; 264 263 } 265 264 266 265 /* free -- it has been defined by create */ ··· 402 403 */ 403 404 static struct platform_driver sh_dac_driver = { 404 405 .probe = snd_sh_dac_probe, 405 - .remove = snd_sh_dac_remove, 406 + .remove_new = snd_sh_dac_remove, 406 407 .driver = { 407 408 .name = "dac_audio", 408 409 },