diff options
author | Hartmut Knaack <knaack.h@gmx.de> | 2014-02-16 06:53:00 -0500 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2014-02-18 03:46:36 -0500 |
commit | 92825ff97411f0121166485798cdaf2deb6b5952 (patch) | |
tree | d410f5fb861d7d128e7fa1287f082f3cb7ac7251 | |
parent | b8a70aef04bf93ba0141008d284ffcdda5883093 (diff) |
iio get rid of unneccessary error_ret
Get rid of obsolete uses of goto error_ret and some empty lines.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r-- | drivers/iio/buffer_cb.c | 7 | ||||
-rw-r--r-- | drivers/iio/industrialio-buffer.c | 16 | ||||
-rw-r--r-- | drivers/iio/industrialio-core.c | 10 | ||||
-rw-r--r-- | drivers/iio/industrialio-event.c | 17 | ||||
-rw-r--r-- | drivers/iio/industrialio-trigger.c | 11 |
5 files changed, 21 insertions, 40 deletions
diff --git a/drivers/iio/buffer_cb.c b/drivers/iio/buffer_cb.c index 2d9c6f8c06db..eb46e728aa2e 100644 --- a/drivers/iio/buffer_cb.c +++ b/drivers/iio/buffer_cb.c | |||
@@ -46,10 +46,8 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, | |||
46 | struct iio_channel *chan; | 46 | struct iio_channel *chan; |
47 | 47 | ||
48 | cb_buff = kzalloc(sizeof(*cb_buff), GFP_KERNEL); | 48 | cb_buff = kzalloc(sizeof(*cb_buff), GFP_KERNEL); |
49 | if (cb_buff == NULL) { | 49 | if (cb_buff == NULL) |
50 | ret = -ENOMEM; | 50 | return ERR_PTR(-ENOMEM); |
51 | goto error_ret; | ||
52 | } | ||
53 | 51 | ||
54 | iio_buffer_init(&cb_buff->buffer); | 52 | iio_buffer_init(&cb_buff->buffer); |
55 | 53 | ||
@@ -91,7 +89,6 @@ error_release_channels: | |||
91 | iio_channel_release_all(cb_buff->channels); | 89 | iio_channel_release_all(cb_buff->channels); |
92 | error_free_cb_buff: | 90 | error_free_cb_buff: |
93 | kfree(cb_buff); | 91 | kfree(cb_buff); |
94 | error_ret: | ||
95 | return ERR_PTR(ret); | 92 | return ERR_PTR(ret); |
96 | } | 93 | } |
97 | EXPORT_SYMBOL_GPL(iio_channel_get_all_cb); | 94 | EXPORT_SYMBOL_GPL(iio_channel_get_all_cb); |
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index c67d83bdc8f0..e108f2a9d827 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c | |||
@@ -264,7 +264,7 @@ static int iio_buffer_add_channel_sysfs(struct iio_dev *indio_dev, | |||
264 | &indio_dev->dev, | 264 | &indio_dev->dev, |
265 | &buffer->scan_el_dev_attr_list); | 265 | &buffer->scan_el_dev_attr_list); |
266 | if (ret) | 266 | if (ret) |
267 | goto error_ret; | 267 | return ret; |
268 | attrcount++; | 268 | attrcount++; |
269 | ret = __iio_add_chan_devattr("type", | 269 | ret = __iio_add_chan_devattr("type", |
270 | chan, | 270 | chan, |
@@ -275,7 +275,7 @@ static int iio_buffer_add_channel_sysfs(struct iio_dev *indio_dev, | |||
275 | &indio_dev->dev, | 275 | &indio_dev->dev, |
276 | &buffer->scan_el_dev_attr_list); | 276 | &buffer->scan_el_dev_attr_list); |
277 | if (ret) | 277 | if (ret) |
278 | goto error_ret; | 278 | return ret; |
279 | attrcount++; | 279 | attrcount++; |
280 | if (chan->type != IIO_TIMESTAMP) | 280 | if (chan->type != IIO_TIMESTAMP) |
281 | ret = __iio_add_chan_devattr("en", | 281 | ret = __iio_add_chan_devattr("en", |
@@ -296,10 +296,9 @@ static int iio_buffer_add_channel_sysfs(struct iio_dev *indio_dev, | |||
296 | &indio_dev->dev, | 296 | &indio_dev->dev, |
297 | &buffer->scan_el_dev_attr_list); | 297 | &buffer->scan_el_dev_attr_list); |
298 | if (ret) | 298 | if (ret) |
299 | goto error_ret; | 299 | return ret; |
300 | attrcount++; | 300 | attrcount++; |
301 | ret = attrcount; | 301 | ret = attrcount; |
302 | error_ret: | ||
303 | return ret; | 302 | return ret; |
304 | } | 303 | } |
305 | 304 | ||
@@ -553,13 +552,13 @@ static int __iio_update_buffers(struct iio_dev *indio_dev, | |||
553 | if (indio_dev->setup_ops->predisable) { | 552 | if (indio_dev->setup_ops->predisable) { |
554 | ret = indio_dev->setup_ops->predisable(indio_dev); | 553 | ret = indio_dev->setup_ops->predisable(indio_dev); |
555 | if (ret) | 554 | if (ret) |
556 | goto error_ret; | 555 | return ret; |
557 | } | 556 | } |
558 | indio_dev->currentmode = INDIO_DIRECT_MODE; | 557 | indio_dev->currentmode = INDIO_DIRECT_MODE; |
559 | if (indio_dev->setup_ops->postdisable) { | 558 | if (indio_dev->setup_ops->postdisable) { |
560 | ret = indio_dev->setup_ops->postdisable(indio_dev); | 559 | ret = indio_dev->setup_ops->postdisable(indio_dev); |
561 | if (ret) | 560 | if (ret) |
562 | goto error_ret; | 561 | return ret; |
563 | } | 562 | } |
564 | } | 563 | } |
565 | /* Keep a copy of current setup to allow roll back */ | 564 | /* Keep a copy of current setup to allow roll back */ |
@@ -613,7 +612,7 @@ static int __iio_update_buffers(struct iio_dev *indio_dev, | |||
613 | else { | 612 | else { |
614 | kfree(compound_mask); | 613 | kfree(compound_mask); |
615 | ret = -EINVAL; | 614 | ret = -EINVAL; |
616 | goto error_ret; | 615 | return ret; |
617 | } | 616 | } |
618 | } | 617 | } |
619 | } else { | 618 | } else { |
@@ -696,13 +695,10 @@ error_run_postdisable: | |||
696 | if (indio_dev->setup_ops->postdisable) | 695 | if (indio_dev->setup_ops->postdisable) |
697 | indio_dev->setup_ops->postdisable(indio_dev); | 696 | indio_dev->setup_ops->postdisable(indio_dev); |
698 | error_remove_inserted: | 697 | error_remove_inserted: |
699 | |||
700 | if (insert_buffer) | 698 | if (insert_buffer) |
701 | iio_buffer_deactivate(insert_buffer); | 699 | iio_buffer_deactivate(insert_buffer); |
702 | indio_dev->active_scan_mask = old_mask; | 700 | indio_dev->active_scan_mask = old_mask; |
703 | kfree(compound_mask); | 701 | kfree(compound_mask); |
704 | error_ret: | ||
705 | |||
706 | return ret; | 702 | return ret; |
707 | } | 703 | } |
708 | 704 | ||
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index acc911a836ca..a85b66081fae 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c | |||
@@ -692,10 +692,8 @@ int __iio_add_chan_devattr(const char *postfix, | |||
692 | struct iio_dev_attr *iio_attr, *t; | 692 | struct iio_dev_attr *iio_attr, *t; |
693 | 693 | ||
694 | iio_attr = kzalloc(sizeof(*iio_attr), GFP_KERNEL); | 694 | iio_attr = kzalloc(sizeof(*iio_attr), GFP_KERNEL); |
695 | if (iio_attr == NULL) { | 695 | if (iio_attr == NULL) |
696 | ret = -ENOMEM; | 696 | return -ENOMEM; |
697 | goto error_ret; | ||
698 | } | ||
699 | ret = __iio_device_attr_init(&iio_attr->dev_attr, | 697 | ret = __iio_device_attr_init(&iio_attr->dev_attr, |
700 | postfix, chan, | 698 | postfix, chan, |
701 | readfunc, writefunc, shared_by); | 699 | readfunc, writefunc, shared_by); |
@@ -720,7 +718,6 @@ error_device_attr_deinit: | |||
720 | __iio_device_attr_deinit(&iio_attr->dev_attr); | 718 | __iio_device_attr_deinit(&iio_attr->dev_attr); |
721 | error_iio_dev_attr_free: | 719 | error_iio_dev_attr_free: |
722 | kfree(iio_attr); | 720 | kfree(iio_attr); |
723 | error_ret: | ||
724 | return ret; | 721 | return ret; |
725 | } | 722 | } |
726 | 723 | ||
@@ -1134,7 +1131,7 @@ int iio_device_register(struct iio_dev *indio_dev) | |||
1134 | if (ret) { | 1131 | if (ret) { |
1135 | dev_err(indio_dev->dev.parent, | 1132 | dev_err(indio_dev->dev.parent, |
1136 | "Failed to register debugfs interfaces\n"); | 1133 | "Failed to register debugfs interfaces\n"); |
1137 | goto error_ret; | 1134 | return ret; |
1138 | } | 1135 | } |
1139 | ret = iio_device_register_sysfs(indio_dev); | 1136 | ret = iio_device_register_sysfs(indio_dev); |
1140 | if (ret) { | 1137 | if (ret) { |
@@ -1175,7 +1172,6 @@ error_free_sysfs: | |||
1175 | iio_device_unregister_sysfs(indio_dev); | 1172 | iio_device_unregister_sysfs(indio_dev); |
1176 | error_unreg_debugfs: | 1173 | error_unreg_debugfs: |
1177 | iio_device_unregister_debugfs(indio_dev); | 1174 | iio_device_unregister_debugfs(indio_dev); |
1178 | error_ret: | ||
1179 | return ret; | 1175 | return ret; |
1180 | } | 1176 | } |
1181 | EXPORT_SYMBOL(iio_device_register); | 1177 | EXPORT_SYMBOL(iio_device_register); |
diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c index c9c1419fe6e0..2e6f8e026fab 100644 --- a/drivers/iio/industrialio-event.c +++ b/drivers/iio/industrialio-event.c | |||
@@ -366,32 +366,31 @@ static int iio_device_add_event_sysfs(struct iio_dev *indio_dev, | |||
366 | ret = iio_device_add_event(indio_dev, chan, i, type, dir, | 366 | ret = iio_device_add_event(indio_dev, chan, i, type, dir, |
367 | IIO_SEPARATE, &chan->event_spec[i].mask_separate); | 367 | IIO_SEPARATE, &chan->event_spec[i].mask_separate); |
368 | if (ret < 0) | 368 | if (ret < 0) |
369 | goto error_ret; | 369 | return ret; |
370 | attrcount += ret; | 370 | attrcount += ret; |
371 | 371 | ||
372 | ret = iio_device_add_event(indio_dev, chan, i, type, dir, | 372 | ret = iio_device_add_event(indio_dev, chan, i, type, dir, |
373 | IIO_SHARED_BY_TYPE, | 373 | IIO_SHARED_BY_TYPE, |
374 | &chan->event_spec[i].mask_shared_by_type); | 374 | &chan->event_spec[i].mask_shared_by_type); |
375 | if (ret < 0) | 375 | if (ret < 0) |
376 | goto error_ret; | 376 | return ret; |
377 | attrcount += ret; | 377 | attrcount += ret; |
378 | 378 | ||
379 | ret = iio_device_add_event(indio_dev, chan, i, type, dir, | 379 | ret = iio_device_add_event(indio_dev, chan, i, type, dir, |
380 | IIO_SHARED_BY_DIR, | 380 | IIO_SHARED_BY_DIR, |
381 | &chan->event_spec[i].mask_shared_by_dir); | 381 | &chan->event_spec[i].mask_shared_by_dir); |
382 | if (ret < 0) | 382 | if (ret < 0) |
383 | goto error_ret; | 383 | return ret; |
384 | attrcount += ret; | 384 | attrcount += ret; |
385 | 385 | ||
386 | ret = iio_device_add_event(indio_dev, chan, i, type, dir, | 386 | ret = iio_device_add_event(indio_dev, chan, i, type, dir, |
387 | IIO_SHARED_BY_ALL, | 387 | IIO_SHARED_BY_ALL, |
388 | &chan->event_spec[i].mask_shared_by_all); | 388 | &chan->event_spec[i].mask_shared_by_all); |
389 | if (ret < 0) | 389 | if (ret < 0) |
390 | goto error_ret; | 390 | return ret; |
391 | attrcount += ret; | 391 | attrcount += ret; |
392 | } | 392 | } |
393 | ret = attrcount; | 393 | ret = attrcount; |
394 | error_ret: | ||
395 | return ret; | 394 | return ret; |
396 | } | 395 | } |
397 | 396 | ||
@@ -440,10 +439,8 @@ int iio_device_register_eventset(struct iio_dev *indio_dev) | |||
440 | 439 | ||
441 | indio_dev->event_interface = | 440 | indio_dev->event_interface = |
442 | kzalloc(sizeof(struct iio_event_interface), GFP_KERNEL); | 441 | kzalloc(sizeof(struct iio_event_interface), GFP_KERNEL); |
443 | if (indio_dev->event_interface == NULL) { | 442 | if (indio_dev->event_interface == NULL) |
444 | ret = -ENOMEM; | 443 | return -ENOMEM; |
445 | goto error_ret; | ||
446 | } | ||
447 | 444 | ||
448 | INIT_LIST_HEAD(&indio_dev->event_interface->dev_attr_list); | 445 | INIT_LIST_HEAD(&indio_dev->event_interface->dev_attr_list); |
449 | 446 | ||
@@ -489,8 +486,6 @@ int iio_device_register_eventset(struct iio_dev *indio_dev) | |||
489 | error_free_setup_event_lines: | 486 | error_free_setup_event_lines: |
490 | iio_free_chan_devattr_list(&indio_dev->event_interface->dev_attr_list); | 487 | iio_free_chan_devattr_list(&indio_dev->event_interface->dev_attr_list); |
491 | kfree(indio_dev->event_interface); | 488 | kfree(indio_dev->event_interface); |
492 | error_ret: | ||
493 | |||
494 | return ret; | 489 | return ret; |
495 | } | 490 | } |
496 | 491 | ||
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index 766fab24b720..3383b025f62e 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c | |||
@@ -62,10 +62,9 @@ int iio_trigger_register(struct iio_trigger *trig_info) | |||
62 | int ret; | 62 | int ret; |
63 | 63 | ||
64 | trig_info->id = ida_simple_get(&iio_trigger_ida, 0, 0, GFP_KERNEL); | 64 | trig_info->id = ida_simple_get(&iio_trigger_ida, 0, 0, GFP_KERNEL); |
65 | if (trig_info->id < 0) { | 65 | if (trig_info->id < 0) |
66 | ret = trig_info->id; | 66 | return trig_info->id; |
67 | goto error_ret; | 67 | |
68 | } | ||
69 | /* Set the name used for the sysfs directory etc */ | 68 | /* Set the name used for the sysfs directory etc */ |
70 | dev_set_name(&trig_info->dev, "trigger%ld", | 69 | dev_set_name(&trig_info->dev, "trigger%ld", |
71 | (unsigned long) trig_info->id); | 70 | (unsigned long) trig_info->id); |
@@ -83,7 +82,6 @@ int iio_trigger_register(struct iio_trigger *trig_info) | |||
83 | 82 | ||
84 | error_unregister_id: | 83 | error_unregister_id: |
85 | ida_simple_remove(&iio_trigger_ida, trig_info->id); | 84 | ida_simple_remove(&iio_trigger_ida, trig_info->id); |
86 | error_ret: | ||
87 | return ret; | 85 | return ret; |
88 | } | 86 | } |
89 | EXPORT_SYMBOL(iio_trigger_register); | 87 | EXPORT_SYMBOL(iio_trigger_register); |
@@ -234,13 +232,12 @@ static int iio_trigger_detach_poll_func(struct iio_trigger *trig, | |||
234 | if (trig->ops && trig->ops->set_trigger_state && no_other_users) { | 232 | if (trig->ops && trig->ops->set_trigger_state && no_other_users) { |
235 | ret = trig->ops->set_trigger_state(trig, false); | 233 | ret = trig->ops->set_trigger_state(trig, false); |
236 | if (ret) | 234 | if (ret) |
237 | goto error_ret; | 235 | return ret; |
238 | } | 236 | } |
239 | iio_trigger_put_irq(trig, pf->irq); | 237 | iio_trigger_put_irq(trig, pf->irq); |
240 | free_irq(pf->irq, pf); | 238 | free_irq(pf->irq, pf); |
241 | module_put(pf->indio_dev->info->driver_module); | 239 | module_put(pf->indio_dev->info->driver_module); |
242 | 240 | ||
243 | error_ret: | ||
244 | return ret; | 241 | return ret; |
245 | } | 242 | } |
246 | 243 | ||