linux/drivers/bus/fsl-mc
Haoxiang Li b662f91e21 bus: fsl-mc: fix an error handling in fsl_mc_device_add()
[ Upstream commit 52f527d091 ]

In fsl_mc_device_add(), device_initialize() is called first.
put_device() should be called to drop the reference if error
occurs. And other resources would be released via put_device
-> fsl_mc_device_release. So remove redundant kfree() in
error handling path.

Fixes: bbf9d17d98 ("staging: fsl-mc: Freescale Management Complex (fsl-mc) bus driver")
Cc: stable@vger.kernel.org
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>
Suggested-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20260124102054.1613093-1-lihaoxiang@isrc.iscas.ac.cn
Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-03-04 07:21:18 -05:00
..
dpbp.c bus: fsl-mc: remove duplicated include files 2018-12-06 15:53:20 +01:00
dpcon.c bus: fsl-mc: remove duplicated include files 2018-12-06 15:53:20 +01:00
dpmcp.c bus: fsl-mc: Remove deadcode 2025-03-21 09:46:08 +01:00
dprc-driver.c bus: fsl-mc: drop useless cleanup 2025-05-13 01:34:57 +02:00
dprc.c bus: fsl-mc: Use strscpy() instead of strscpy_pad() 2025-05-13 01:39:01 +02:00
fsl-mc-allocator.c bus: fsl-mc: drop useless cleanup 2025-05-13 01:34:57 +02:00
fsl-mc-bus.c bus: fsl-mc: fix an error handling in fsl_mc_device_add() 2026-03-04 07:21:18 -05:00
fsl-mc-msi.c bus: Explicitly include correct DT includes 2023-08-12 10:31:01 +02:00
fsl-mc-private.h bus: fsl-mc: drop useless cleanup 2025-05-13 01:34:57 +02:00
fsl-mc-uapi.c bus: fsl-mc: add the dprc_get_mem() command to the whitelist 2025-05-13 01:34:57 +02:00
Kconfig genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN 2022-11-17 15:15:20 +01:00
Makefile bus/fsl-mc: Add generic implementation for open/reset/close commands 2021-09-28 16:56:05 -06:00
mc-io.c bus: fsl-mc: do not add a device-link for the UAPI used DPMCP device 2025-05-13 01:34:57 +02:00
mc-sys.c bus: fsl-mc: increase MC_CMD_COMPLETION_TIMEOUT_MS value 2025-05-13 01:34:57 +02:00
obj-api.c bus/fsl-mc: Add generic implementation for open/reset/close commands 2021-09-28 16:56:05 -06:00