Skip to content

Commit e0d43ed

Browse files
Uwe Kleine-KönigLi Yang
authored andcommitted
bus: fsl-mc: fsl-mc-allocator: Initialize mc_bus_dev before use
Fixes a clang compiler warning: >> drivers/bus/fsl-mc/fsl-mc-allocator.c:108:12: warning: variable 'mc_bus_dev' is uninitialized when used here [-Wuninitialized] dev_err(&mc_bus_dev->dev, "resource mismatch\n"); Fixes: b313403 ("bus: fsl-mc: fsl-mc-allocator: Improve error reporting") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202306021936.OktTcMAT-lkp@intel.com/ Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Li Yang <leoyang.li@nxp.com>
1 parent 7b1a78b commit e0d43ed

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/bus/fsl-mc/fsl-mc-allocator.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,15 @@ static int __must_check fsl_mc_resource_pool_remove_device(struct fsl_mc_device
103103
struct fsl_mc_resource *resource;
104104
int error = -EINVAL;
105105

106+
mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
107+
mc_bus = to_fsl_mc_bus(mc_bus_dev);
108+
106109
resource = mc_dev->resource;
107110
if (!resource || resource->data != mc_dev) {
108111
dev_err(&mc_bus_dev->dev, "resource mismatch\n");
109112
goto out;
110113
}
111114

112-
mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
113-
mc_bus = to_fsl_mc_bus(mc_bus_dev);
114115
res_pool = resource->parent_pool;
115116
if (res_pool != &mc_bus->resource_pools[resource->type]) {
116117
dev_err(&mc_bus_dev->dev, "pool mismatch\n");

0 commit comments

Comments
 (0)