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

media: dma2d: 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>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Uwe Kleine-König and committed by
Hans Verkuil
41579d57 b7186d94

+2 -4
+2 -4
drivers/media/platform/st/stm32/dma2d/dma2d.c
··· 693 693 return ret; 694 694 } 695 695 696 - static int dma2d_remove(struct platform_device *pdev) 696 + static void dma2d_remove(struct platform_device *pdev) 697 697 { 698 698 struct dma2d_dev *dev = platform_get_drvdata(pdev); 699 699 ··· 704 704 vb2_dma_contig_clear_max_seg_size(&pdev->dev); 705 705 clk_unprepare(dev->gate); 706 706 clk_put(dev->gate); 707 - 708 - return 0; 709 707 } 710 708 711 709 static const struct of_device_id stm32_dma2d_match[] = { ··· 717 719 718 720 static struct platform_driver dma2d_pdrv = { 719 721 .probe = dma2d_probe, 720 - .remove = dma2d_remove, 722 + .remove_new = dma2d_remove, 721 723 .driver = { 722 724 .name = DMA2D_NAME, 723 725 .of_match_table = stm32_dma2d_match,