staging: fsl-mc: fix device ref counting
authorLaurentiu Tudor <laurentiu.tudor@nxp.com>
Tue, 7 Feb 2017 15:43:45 +0000 (09:43 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2017 12:26:01 +0000 (13:26 +0100)
Drop unneeded get_device() call at device creation
and, as per documentation, drop reference count
after using device_find_child() return.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Acked-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fsl-mc/bus/dprc-driver.c
drivers/staging/fsl-mc/bus/fsl-mc-bus.c

index 4e416d89b736ff47c28886e449a986445bef4b83..e4b0341d42d742ad98d6f5c3fbc8442fc40faf70 100644 (file)
@@ -188,6 +188,7 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev,
                child_dev = fsl_mc_device_lookup(obj_desc, mc_bus_dev);
                if (child_dev) {
                        check_plugged_state_change(child_dev, obj_desc);
+                       put_device(&child_dev->dev);
                        continue;
                }
 
index cc20dc4541853d61aab33b9334e9ae76b790f798..7c6a43b2c0dc178a34c9fd102c6ffcf311d25627 100644 (file)
@@ -537,7 +537,6 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
                goto error_cleanup_dev;
        }
 
-       (void)get_device(&mc_dev->dev);
        dev_dbg(parent_dev, "added %s\n", dev_name(&mc_dev->dev));
 
        *new_mc_dev = mc_dev;