Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a042fbed authored by Laurentiu Tudor's avatar Laurentiu Tudor Committed by Greg Kroah-Hartman
Browse files

staging: fsl-mc: simplify couple of deallocations



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: default avatarLaurentiu Tudor <laurentiu.tudor@nxp.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 72f3415f
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -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,9 +555,7 @@ 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);

	return error;