diff options
author | J. German Rivera <German.Rivera@freescale.com> | 2015-03-27 21:01:07 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-03 11:55:03 (GMT) |
commit | 2bdc55d94fef59296f9f1aeda2a503d4c64cad86 (patch) | |
tree | d1aa153da79e6820cd90f4c50a7abc0a153d3895 /drivers/staging/fsl-mc/bus/mc-bus.c | |
parent | 1663e80982eef51892576cb2e3d4978af787ca4d (diff) | |
download | linux-2bdc55d94fef59296f9f1aeda2a503d4c64cad86.tar.xz |
staging: fsl-mc: Fix crash in fsl_mc_device_remove()
Only call fsl_mc_io_destroy() if the DPRC being removed
actually had an mc_io object associated with. Child DPRCs
that have not been bound to the DPRC driver or the VFIO driver
will not have an mc_io associated with them.
Signed-off-by: J. German Rivera <German.Rivera@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fsl-mc/bus/mc-bus.c')
-rw-r--r-- | drivers/staging/fsl-mc/bus/mc-bus.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c index de15fa9..d943d99 100644 --- a/drivers/staging/fsl-mc/bus/mc-bus.c +++ b/drivers/staging/fsl-mc/bus/mc-bus.c @@ -444,15 +444,16 @@ void fsl_mc_device_remove(struct fsl_mc_device *mc_dev) put_device(&mc_dev->dev); if (strcmp(mc_dev->obj_desc.type, "dprc") == 0) { - struct fsl_mc_io *mc_io = mc_dev->mc_io; - mc_bus = to_fsl_mc_bus(mc_dev); - fsl_destroy_mc_io(mc_io); + if (mc_dev->mc_io) { + fsl_destroy_mc_io(mc_dev->mc_io); + mc_dev->mc_io = NULL; + } + if (&mc_dev->dev == fsl_mc_bus_type.dev_root) fsl_mc_bus_type.dev_root = NULL; } - mc_dev->mc_io = NULL; if (mc_bus) devm_kfree(mc_dev->dev.parent, mc_bus); else |