]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bus: fsl-mc: fix an error handling in fsl_mc_device_add()
authorHaoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Sat, 24 Jan 2026 10:20:54 +0000 (18:20 +0800)
committerSasha Levin <sashal@kernel.org>
Wed, 4 Mar 2026 12:21:18 +0000 (07:21 -0500)
commitb662f91e216fded3d52e48e05e848a92c3bb8f72
treefa5b81af960ac08853e0bdb374f16514204de7b0
parentab81f9f3319e081b4a3201bbf7a846b7a4c10a04
bus: fsl-mc: fix an error handling in fsl_mc_device_add()

[ Upstream commit 52f527d0916bcdd7621a0c9e7e599b133294d495 ]

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: bbf9d17d9875 ("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>
drivers/bus/fsl-mc/fsl-mc-bus.c