Commit 92825ff9 authored by Hartmut Knaack's avatar Hartmut Knaack Committed by Jonathan Cameron

iio get rid of unneccessary error_ret

Get rid of obsolete uses of goto error_ret and some empty lines.
Signed-off-by: default avatarHartmut Knaack <knaack.h@gmx.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent b8a70aef
...@@ -46,10 +46,8 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, ...@@ -46,10 +46,8 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev,
struct iio_channel *chan; struct iio_channel *chan;
cb_buff = kzalloc(sizeof(*cb_buff), GFP_KERNEL); cb_buff = kzalloc(sizeof(*cb_buff), GFP_KERNEL);
if (cb_buff == NULL) { if (cb_buff == NULL)
ret = -ENOMEM; return ERR_PTR(-ENOMEM);
goto error_ret;
}
iio_buffer_init(&cb_buff->buffer); iio_buffer_init(&cb_buff->buffer);
...@@ -91,7 +89,6 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, ...@@ -91,7 +89,6 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev,
iio_channel_release_all(cb_buff->channels); iio_channel_release_all(cb_buff->channels);
error_free_cb_buff: error_free_cb_buff:
kfree(cb_buff); kfree(cb_buff);
error_ret:
return ERR_PTR(ret); return ERR_PTR(ret);
} }
EXPORT_SYMBOL_GPL(iio_channel_get_all_cb); EXPORT_SYMBOL_GPL(iio_channel_get_all_cb);
......
...@@ -264,7 +264,7 @@ static int iio_buffer_add_channel_sysfs(struct iio_dev *indio_dev, ...@@ -264,7 +264,7 @@ static int iio_buffer_add_channel_sysfs(struct iio_dev *indio_dev,
&indio_dev->dev, &indio_dev->dev,
&buffer->scan_el_dev_attr_list); &buffer->scan_el_dev_attr_list);
if (ret) if (ret)
goto error_ret; return ret;
attrcount++; attrcount++;
ret = __iio_add_chan_devattr("type", ret = __iio_add_chan_devattr("type",
chan, chan,
...@@ -275,7 +275,7 @@ static int iio_buffer_add_channel_sysfs(struct iio_dev *indio_dev, ...@@ -275,7 +275,7 @@ static int iio_buffer_add_channel_sysfs(struct iio_dev *indio_dev,
&indio_dev->dev, &indio_dev->dev,
&buffer->scan_el_dev_attr_list); &buffer->scan_el_dev_attr_list);
if (ret) if (ret)
goto error_ret; return ret;
attrcount++; attrcount++;
if (chan->type != IIO_TIMESTAMP) if (chan->type != IIO_TIMESTAMP)
ret = __iio_add_chan_devattr("en", ret = __iio_add_chan_devattr("en",
...@@ -296,10 +296,9 @@ static int iio_buffer_add_channel_sysfs(struct iio_dev *indio_dev, ...@@ -296,10 +296,9 @@ static int iio_buffer_add_channel_sysfs(struct iio_dev *indio_dev,
&indio_dev->dev, &indio_dev->dev,
&buffer->scan_el_dev_attr_list); &buffer->scan_el_dev_attr_list);
if (ret) if (ret)
goto error_ret; return ret;
attrcount++; attrcount++;
ret = attrcount; ret = attrcount;
error_ret:
return ret; return ret;
} }
...@@ -553,13 +552,13 @@ static int __iio_update_buffers(struct iio_dev *indio_dev, ...@@ -553,13 +552,13 @@ static int __iio_update_buffers(struct iio_dev *indio_dev,
if (indio_dev->setup_ops->predisable) { if (indio_dev->setup_ops->predisable) {
ret = indio_dev->setup_ops->predisable(indio_dev); ret = indio_dev->setup_ops->predisable(indio_dev);
if (ret) if (ret)
goto error_ret; return ret;
} }
indio_dev->currentmode = INDIO_DIRECT_MODE; indio_dev->currentmode = INDIO_DIRECT_MODE;
if (indio_dev->setup_ops->postdisable) { if (indio_dev->setup_ops->postdisable) {
ret = indio_dev->setup_ops->postdisable(indio_dev); ret = indio_dev->setup_ops->postdisable(indio_dev);
if (ret) if (ret)
goto error_ret; return ret;
} }
} }
/* Keep a copy of current setup to allow roll back */ /* 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,7 +612,7 @@ static int __iio_update_buffers(struct iio_dev *indio_dev,
else { else {
kfree(compound_mask); kfree(compound_mask);
ret = -EINVAL; ret = -EINVAL;
goto error_ret; return ret;
} }
} }
} else { } else {
...@@ -696,13 +695,10 @@ static int __iio_update_buffers(struct iio_dev *indio_dev, ...@@ -696,13 +695,10 @@ static int __iio_update_buffers(struct iio_dev *indio_dev,
if (indio_dev->setup_ops->postdisable) if (indio_dev->setup_ops->postdisable)
indio_dev->setup_ops->postdisable(indio_dev); indio_dev->setup_ops->postdisable(indio_dev);
error_remove_inserted: error_remove_inserted:
if (insert_buffer) if (insert_buffer)
iio_buffer_deactivate(insert_buffer); iio_buffer_deactivate(insert_buffer);
indio_dev->active_scan_mask = old_mask; indio_dev->active_scan_mask = old_mask;
kfree(compound_mask); kfree(compound_mask);
error_ret:
return ret; return ret;
} }
......
...@@ -692,10 +692,8 @@ int __iio_add_chan_devattr(const char *postfix, ...@@ -692,10 +692,8 @@ int __iio_add_chan_devattr(const char *postfix,
struct iio_dev_attr *iio_attr, *t; struct iio_dev_attr *iio_attr, *t;
iio_attr = kzalloc(sizeof(*iio_attr), GFP_KERNEL); iio_attr = kzalloc(sizeof(*iio_attr), GFP_KERNEL);
if (iio_attr == NULL) { if (iio_attr == NULL)
ret = -ENOMEM; return -ENOMEM;
goto error_ret;
}
ret = __iio_device_attr_init(&iio_attr->dev_attr, ret = __iio_device_attr_init(&iio_attr->dev_attr,
postfix, chan, postfix, chan,
readfunc, writefunc, shared_by); readfunc, writefunc, shared_by);
...@@ -720,7 +718,6 @@ int __iio_add_chan_devattr(const char *postfix, ...@@ -720,7 +718,6 @@ int __iio_add_chan_devattr(const char *postfix,
__iio_device_attr_deinit(&iio_attr->dev_attr); __iio_device_attr_deinit(&iio_attr->dev_attr);
error_iio_dev_attr_free: error_iio_dev_attr_free:
kfree(iio_attr); kfree(iio_attr);
error_ret:
return ret; return ret;
} }
...@@ -1134,7 +1131,7 @@ int iio_device_register(struct iio_dev *indio_dev) ...@@ -1134,7 +1131,7 @@ int iio_device_register(struct iio_dev *indio_dev)
if (ret) { if (ret) {
dev_err(indio_dev->dev.parent, dev_err(indio_dev->dev.parent,
"Failed to register debugfs interfaces\n"); "Failed to register debugfs interfaces\n");
goto error_ret; return ret;
} }
ret = iio_device_register_sysfs(indio_dev); ret = iio_device_register_sysfs(indio_dev);
if (ret) { if (ret) {
...@@ -1175,7 +1172,6 @@ int iio_device_register(struct iio_dev *indio_dev) ...@@ -1175,7 +1172,6 @@ int iio_device_register(struct iio_dev *indio_dev)
iio_device_unregister_sysfs(indio_dev); iio_device_unregister_sysfs(indio_dev);
error_unreg_debugfs: error_unreg_debugfs:
iio_device_unregister_debugfs(indio_dev); iio_device_unregister_debugfs(indio_dev);
error_ret:
return ret; return ret;
} }
EXPORT_SYMBOL(iio_device_register); EXPORT_SYMBOL(iio_device_register);
......
...@@ -366,32 +366,31 @@ static int iio_device_add_event_sysfs(struct iio_dev *indio_dev, ...@@ -366,32 +366,31 @@ static int iio_device_add_event_sysfs(struct iio_dev *indio_dev,
ret = iio_device_add_event(indio_dev, chan, i, type, dir, ret = iio_device_add_event(indio_dev, chan, i, type, dir,
IIO_SEPARATE, &chan->event_spec[i].mask_separate); IIO_SEPARATE, &chan->event_spec[i].mask_separate);
if (ret < 0) if (ret < 0)
goto error_ret; return ret;
attrcount += ret; attrcount += ret;
ret = iio_device_add_event(indio_dev, chan, i, type, dir, ret = iio_device_add_event(indio_dev, chan, i, type, dir,
IIO_SHARED_BY_TYPE, IIO_SHARED_BY_TYPE,
&chan->event_spec[i].mask_shared_by_type); &chan->event_spec[i].mask_shared_by_type);
if (ret < 0) if (ret < 0)
goto error_ret; return ret;
attrcount += ret; attrcount += ret;
ret = iio_device_add_event(indio_dev, chan, i, type, dir, ret = iio_device_add_event(indio_dev, chan, i, type, dir,
IIO_SHARED_BY_DIR, IIO_SHARED_BY_DIR,
&chan->event_spec[i].mask_shared_by_dir); &chan->event_spec[i].mask_shared_by_dir);
if (ret < 0) if (ret < 0)
goto error_ret; return ret;
attrcount += ret; attrcount += ret;
ret = iio_device_add_event(indio_dev, chan, i, type, dir, ret = iio_device_add_event(indio_dev, chan, i, type, dir,
IIO_SHARED_BY_ALL, IIO_SHARED_BY_ALL,
&chan->event_spec[i].mask_shared_by_all); &chan->event_spec[i].mask_shared_by_all);
if (ret < 0) if (ret < 0)
goto error_ret; return ret;
attrcount += ret; attrcount += ret;
} }
ret = attrcount; ret = attrcount;
error_ret:
return ret; return ret;
} }
...@@ -440,10 +439,8 @@ int iio_device_register_eventset(struct iio_dev *indio_dev) ...@@ -440,10 +439,8 @@ int iio_device_register_eventset(struct iio_dev *indio_dev)
indio_dev->event_interface = indio_dev->event_interface =
kzalloc(sizeof(struct iio_event_interface), GFP_KERNEL); kzalloc(sizeof(struct iio_event_interface), GFP_KERNEL);
if (indio_dev->event_interface == NULL) { if (indio_dev->event_interface == NULL)
ret = -ENOMEM; return -ENOMEM;
goto error_ret;
}
INIT_LIST_HEAD(&indio_dev->event_interface->dev_attr_list); INIT_LIST_HEAD(&indio_dev->event_interface->dev_attr_list);
...@@ -489,8 +486,6 @@ int iio_device_register_eventset(struct iio_dev *indio_dev) ...@@ -489,8 +486,6 @@ int iio_device_register_eventset(struct iio_dev *indio_dev)
error_free_setup_event_lines: error_free_setup_event_lines:
iio_free_chan_devattr_list(&indio_dev->event_interface->dev_attr_list); iio_free_chan_devattr_list(&indio_dev->event_interface->dev_attr_list);
kfree(indio_dev->event_interface); kfree(indio_dev->event_interface);
error_ret:
return ret; return ret;
} }
......
...@@ -62,10 +62,9 @@ int iio_trigger_register(struct iio_trigger *trig_info) ...@@ -62,10 +62,9 @@ int iio_trigger_register(struct iio_trigger *trig_info)
int ret; int ret;
trig_info->id = ida_simple_get(&iio_trigger_ida, 0, 0, GFP_KERNEL); trig_info->id = ida_simple_get(&iio_trigger_ida, 0, 0, GFP_KERNEL);
if (trig_info->id < 0) { if (trig_info->id < 0)
ret = trig_info->id; return trig_info->id;
goto error_ret;
}
/* Set the name used for the sysfs directory etc */ /* Set the name used for the sysfs directory etc */
dev_set_name(&trig_info->dev, "trigger%ld", dev_set_name(&trig_info->dev, "trigger%ld",
(unsigned long) trig_info->id); (unsigned long) trig_info->id);
...@@ -83,7 +82,6 @@ int iio_trigger_register(struct iio_trigger *trig_info) ...@@ -83,7 +82,6 @@ int iio_trigger_register(struct iio_trigger *trig_info)
error_unregister_id: error_unregister_id:
ida_simple_remove(&iio_trigger_ida, trig_info->id); ida_simple_remove(&iio_trigger_ida, trig_info->id);
error_ret:
return ret; return ret;
} }
EXPORT_SYMBOL(iio_trigger_register); EXPORT_SYMBOL(iio_trigger_register);
...@@ -234,13 +232,12 @@ static int iio_trigger_detach_poll_func(struct iio_trigger *trig, ...@@ -234,13 +232,12 @@ static int iio_trigger_detach_poll_func(struct iio_trigger *trig,
if (trig->ops && trig->ops->set_trigger_state && no_other_users) { if (trig->ops && trig->ops->set_trigger_state && no_other_users) {
ret = trig->ops->set_trigger_state(trig, false); ret = trig->ops->set_trigger_state(trig, false);
if (ret) if (ret)
goto error_ret; return ret;
} }
iio_trigger_put_irq(trig, pf->irq); iio_trigger_put_irq(trig, pf->irq);
free_irq(pf->irq, pf); free_irq(pf->irq, pf);
module_put(pf->indio_dev->info->driver_module); module_put(pf->indio_dev->info->driver_module);
error_ret:
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment