]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
staging: fsl-mc: simplify couple of deallocations
authorLaurentiu Tudor <laurentiu.tudor@nxp.com>
Thu, 8 Jun 2017 14:28:48 +0000 (17:28 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Jun 2017 10:14:12 +0000 (12:14 +0200)
Simplify a couple of deallocations code paths. This also fixes these
checkpatch.pl false positives:
 "WARNING: kfree(NULL) is safe and this check is probably not required"

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

index 50eb41588a65850d4b866ee2cf1b6ed456827b95..7b48ade1ca9c05ce041a24754c347fd75683ff20 100644 (file)
@@ -420,15 +420,11 @@ bool fsl_mc_is_root_dprc(struct device *dev)
 static void fsl_mc_device_release(struct device *dev)
 {
        struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
-       struct fsl_mc_bus *mc_bus = NULL;
 
        kfree(mc_dev->regions);
 
        if (strcmp(mc_dev->obj_desc.type, "dprc") == 0)
-               mc_bus = to_fsl_mc_bus(mc_dev);
-
-       if (mc_bus)
-               kfree(mc_bus);
+               kfree(to_fsl_mc_bus(mc_dev));
        else
                kfree(mc_dev);
 }
@@ -559,10 +555,8 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
 
 error_cleanup_dev:
        kfree(mc_dev->regions);
-       if (mc_bus)
-               kfree(mc_bus);
-       else
-               kfree(mc_dev);
+       kfree(mc_bus);
+       kfree(mc_dev);
 
        return error;
 }