linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bus: fsl-mc: fix an error handling in fsl_mc_device_add()
@ 2025-12-22  7:49 Haoxiang Li
  2025-12-22 23:13 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Haoxiang Li @ 2025-12-22  7:49 UTC (permalink / raw)
  To: ioana.ciornei
  Cc: linuxppc-dev, linux-kernel, Haoxiang Li, Dan Carpenter, Su Hui

If device_add() fails, call put_device() to drop the device
reference and do the cleanp.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/b767348e-d89c-416e-acea-1ebbff3bea20@stanley.mountain/
Signed-off-by: Su Hui <suhui@nfschina.com>
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
 drivers/bus/fsl-mc/fsl-mc-bus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 25845c04e562..90a2107a9905 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -896,7 +896,8 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
 		dev_err(parent_dev,
 			"device_add() failed for device %s: %d\n",
 			dev_name(&mc_dev->dev), error);
-		goto error_cleanup_dev;
+		put_device(&mc_dev->dev)
+		return error;
 	}
 
 	dev_dbg(parent_dev, "added %s\n", dev_name(&mc_dev->dev));
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-12-26  9:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-22  7:49 [PATCH] bus: fsl-mc: fix an error handling in fsl_mc_device_add() Haoxiang Li
2025-12-22 23:13 ` kernel test robot
2025-12-23 15:23 ` kernel test robot
2025-12-23 15:34 ` Christophe Leroy (CS GROUP)
2025-12-24  7:54   ` Dan Carpenter
2025-12-24  9:57     ` Christophe Leroy (CS GROUP)
2025-12-24 10:52       ` Haoxiang Li
2025-12-24 11:07         ` Christophe Leroy (CS GROUP)
2025-12-24 11:26           ` Haoxiang Li
2025-12-26  9:39             ` Dan Carpenter
2025-12-26  9:35       ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).