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

media: nuvoton: 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: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Uwe Kleine-König and committed by
Hans Verkuil
289eb352 ad9be163

+2 -4
+2 -4
drivers/media/platform/nuvoton/npcm-video.c
··· 1785 1785 return 0; 1786 1786 } 1787 1787 1788 - static int npcm_video_remove(struct platform_device *pdev) 1788 + static void npcm_video_remove(struct platform_device *pdev) 1789 1789 { 1790 1790 struct device *dev = &pdev->dev; 1791 1791 struct v4l2_device *v4l2_dev = dev_get_drvdata(dev); ··· 1798 1798 if (video->ece.enable) 1799 1799 npcm_video_ece_stop(video); 1800 1800 of_reserved_mem_device_release(dev); 1801 - 1802 - return 0; 1803 1801 } 1804 1802 1805 1803 static const struct of_device_id npcm_video_match[] = { ··· 1814 1816 .of_match_table = npcm_video_match, 1815 1817 }, 1816 1818 .probe = npcm_video_probe, 1817 - .remove = npcm_video_remove, 1819 + .remove_new = npcm_video_remove, 1818 1820 }; 1819 1821 1820 1822 module_platform_driver(npcm_video_driver);