[PATCH 1/8] coresight: ultrasoc-smb: Fix resource leak in .remove()

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Tue Nov 7 12:28:20 PST 2023


If smb_config_inport() fails it's still necessary to unregister all
resources. As smb_config_inport() already emits an error message on
failure, there is no need to add another one. By not returning the error
code, a second error message (about the return value being ignored) is
suppressed.

Fixes: 06f5c2926aaa ("drivers/coresight: Add UltraSoc System Memory Buffer driver")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
 drivers/hwtracing/coresight/ultrasoc-smb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/hwtracing/coresight/ultrasoc-smb.c b/drivers/hwtracing/coresight/ultrasoc-smb.c
index e9a32a97fbee..10e7d4852112 100644
--- a/drivers/hwtracing/coresight/ultrasoc-smb.c
+++ b/drivers/hwtracing/coresight/ultrasoc-smb.c
@@ -613,11 +613,8 @@ static int smb_probe(struct platform_device *pdev)
 static int smb_remove(struct platform_device *pdev)
 {
 	struct smb_drv_data *drvdata = platform_get_drvdata(pdev);
-	int ret;
 
-	ret = smb_config_inport(&pdev->dev, false);
-	if (ret)
-		return ret;
+	smb_config_inport(&pdev->dev, false);
 
 	smb_unregister_sink(drvdata);
 
-- 
2.42.0




More information about the linux-arm-kernel mailing list