diff options
author | Dennis Dalessandro <dennis.dalessandro@intel.com> | 2016-05-19 12:22:03 (GMT) |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-05-26 15:23:11 (GMT) |
commit | f3225c3f1107104f5e143797550476182b844cfb (patch) | |
tree | da2709f72164057395bedccbffb74c270d9e6546 | |
parent | b583faf4dc6eaa64895c37b81983e75a8c3c1e4e (diff) | |
download | linux-f3225c3f1107104f5e143797550476182b844cfb.tar.xz |
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: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | drivers/staging/rdma/hfi1/device.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/staging/rdma/hfi1/device.c b/drivers/staging/rdma/hfi1/device.c index c05c39d..6ee800f 100644 --- a/drivers/staging/rdma/hfi1/device.c +++ b/drivers/staging/rdma/hfi1/device.c @@ -82,13 +82,13 @@ int hfi1_cdev_init(int minor, const char *name, else device = device_create(class, NULL, dev, NULL, "%s", name); - if (!IS_ERR(device)) - goto done; - ret = PTR_ERR(device); - device = NULL; - pr_err("Could not create device for minor %d, %s (err %d)\n", - minor, name, -ret); - cdev_del(cdev); + if (IS_ERR(device)) { + ret = PTR_ERR(device); + device = NULL; + pr_err("Could not create device for minor %d, %s (err %d)\n", + minor, name, -ret); + cdev_del(cdev); + } done: *devp = device; return ret; |