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

Commit f3225c3f authored by Dennis Dalessandro's avatar Dennis Dalessandro Committed by Doug Ledford
Browse files

IB/hfi1: Remove anti-pattern in cdev init



Remove the usage of an anti-pattern goto in hfi1_cdev_init to improve
code readability.

Suggested-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent b583faf4
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -82,13 +82,13 @@ int hfi1_cdev_init(int minor, const char *name,
	else
	else
		device = device_create(class, NULL, dev, NULL, "%s", name);
		device = device_create(class, NULL, dev, NULL, "%s", name);


	if (!IS_ERR(device))
	if (IS_ERR(device)) {
		goto done;
		ret = PTR_ERR(device);
		ret = PTR_ERR(device);
		device = NULL;
		device = NULL;
		pr_err("Could not create device for minor %d, %s (err %d)\n",
		pr_err("Could not create device for minor %d, %s (err %d)\n",
			minor, name, -ret);
			minor, name, -ret);
		cdev_del(cdev);
		cdev_del(cdev);
	}
done:
done:
	*devp = device;
	*devp = device;
	return ret;
	return ret;