[PATCH 4/4] docs: driver-api: firmware_loader: Convert to platform remove callback returning void

zhangheng zhangheng at kylinos.cn
Sat Nov 9 01:22:02 PST 2024


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.

Trivially convert the mediatek drm drivers from always returning zero in
the remove callback to the void returning variant.

Signed-off-by: zhangheng <zhangheng at kylinos.cn>
---
 Documentation/driver-api/firmware/fw_upload.rst | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Documentation/driver-api/firmware/fw_upload.rst b/Documentation/driver-api/firmware/fw_upload.rst
index edf1d0c5e7c3..b339265655ee 100644
--- a/Documentation/driver-api/firmware/fw_upload.rst
+++ b/Documentation/driver-api/firmware/fw_upload.rst
@@ -69,13 +69,12 @@ function calls firmware_upload_unregister() such as::
 		return 0;
 	}
 
-	static int m10bmc_sec_remove(struct platform_device *pdev)
+	static void m10bmc_sec_remove(struct platform_device *pdev)
 	{
 		struct m10bmc_sec *sec = dev_get_drvdata(&pdev->dev);
 
 		firmware_upload_unregister(sec->fwl);
 		kfree(sec->fw_name);
-		return 0;
 	}
 
 firmware_upload_register
-- 
2.45.2




More information about the Linux-mediatek mailing list