Skip to content

Commit

Permalink
staging: most: fix label names
Browse files Browse the repository at this point in the history
This patch makes use of label names that say what the goto
actually does, as recommended in the kernel documentation.

Signed-off-by: Christian Gromm <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
cgro authored and gregkh committed Sep 25, 2018
1 parent bfeb67e commit bddd3c2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 41 deletions.
12 changes: 6 additions & 6 deletions drivers/staging/most/cdev/cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ static int comp_probe(struct most_interface *iface, int channel_id,
c = kzalloc(sizeof(*c), GFP_KERNEL);
if (!c) {
retval = -ENOMEM;
goto error_alloc_channel;
goto err_remove_ida;
}

c->devno = MKDEV(comp.major, current_minor);
Expand All @@ -463,7 +463,7 @@ static int comp_probe(struct most_interface *iface, int channel_id,
retval = kfifo_alloc(&c->fifo, cfg->num_buffers, GFP_KERNEL);
if (retval) {
pr_info("failed to alloc channel kfifo");
goto error_alloc_kfifo;
goto err_del_cdev_and_free_channel;
}
init_waitqueue_head(&c->wq);
mutex_init(&c->io_mutex);
Expand All @@ -475,18 +475,18 @@ static int comp_probe(struct most_interface *iface, int channel_id,
if (IS_ERR(c->dev)) {
retval = PTR_ERR(c->dev);
pr_info("failed to create new device node %s\n", name);
goto error_create_device;
goto err_free_kfifo_and_del_list;
}
kobject_uevent(&c->dev->kobj, KOBJ_ADD);
return 0;

error_create_device:
err_free_kfifo_and_del_list:
kfifo_free(&c->fifo);
list_del(&c->list);
error_alloc_kfifo:
err_del_cdev_and_free_channel:
cdev_del(&c->cdev);
kfree(c);
error_alloc_channel:
err_remove_ida:
ida_simple_remove(&comp.minor_id, current_minor);
return retval;
}
Expand Down
24 changes: 12 additions & 12 deletions drivers/staging/most/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ int most_start_channel(struct most_interface *iface, int id,
if (c->iface->configure(c->iface, c->channel_id, &c->cfg)) {
pr_info("channel configuration failed. Go check settings...\n");
ret = -EINVAL;
goto error;
goto err_put_module;
}

init_waitqueue_head(&c->hdm_fifo_wq);
Expand All @@ -1248,12 +1248,12 @@ int most_start_channel(struct most_interface *iface, int id,
most_write_completion);
if (unlikely(!num_buffer)) {
ret = -ENOMEM;
goto error;
goto err_put_module;
}

ret = run_enqueue_thread(c, id);
if (ret)
goto error;
goto err_put_module;

c->is_starving = 0;
c->pipe0.num_buffers = c->cfg.num_buffers / 2;
Expand All @@ -1268,7 +1268,7 @@ int most_start_channel(struct most_interface *iface, int id,
mutex_unlock(&c->start_mutex);
return 0;

error:
err_put_module:
module_put(iface->mod);
mutex_unlock(&c->start_mutex);
return ret;
Expand Down Expand Up @@ -1449,7 +1449,7 @@ int most_register_interface(struct most_interface *iface)

c = kzalloc(sizeof(*c), GFP_KERNEL);
if (!c)
goto free_instance;
goto err_free_resources;
if (!name_suffix)
snprintf(c->name, STRING_SIZE, "ch%d", i);
else
Expand Down Expand Up @@ -1482,17 +1482,17 @@ int most_register_interface(struct most_interface *iface)
list_add_tail(&c->list, &iface->p->channel_list);
if (device_register(&c->dev)) {
pr_err("registering c->dev failed\n");
goto free_instance_nodev;
goto err_free_most_channel;
}
}
pr_info("registered new device mdev%d (%s)\n",
id, iface->description);
return 0;

free_instance_nodev:
err_free_most_channel:
kfree(c);

free_instance:
err_free_resources:
while (i > 0) {
c = iface->p->channel[--i];
device_unregister(&c->dev);
Expand Down Expand Up @@ -1613,20 +1613,20 @@ static int __init most_init(void)
err = driver_register(&mc.drv);
if (err) {
pr_info("Cannot register core driver\n");
goto exit_bus;
goto err_unregister_bus;
}
mc.dev.init_name = "most_bus";
mc.dev.release = release_most_sub;
if (device_register(&mc.dev)) {
err = -ENOMEM;
goto exit_driver;
goto err_unregister_driver;
}

return 0;

exit_driver:
err_unregister_driver:
driver_unregister(&mc.drv);
exit_bus:
err_unregister_bus:
bus_unregister(&mc.bus);
return err;
}
Expand Down
46 changes: 23 additions & 23 deletions drivers/staging/most/usb/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,19 +568,19 @@ static int hdm_enqueue(struct most_interface *iface, int channel,
mutex_lock(&mdev->io_mutex);
if (!mdev->usb_device) {
retval = -ENODEV;
goto _exit;
goto unlock_io_mutex;
}

urb = usb_alloc_urb(NO_ISOCHRONOUS_URB, GFP_ATOMIC);
if (!urb) {
retval = -ENOMEM;
goto _exit;
goto unlock_io_mutex;
}

if ((conf->direction & MOST_CH_TX) && mdev->padding_active[channel] &&
hdm_add_padding(mdev, channel, mbo)) {
retval = -EIO;
goto _error;
goto err_free_urb;
}

urb->transfer_dma = mbo->bus_address;
Expand Down Expand Up @@ -615,15 +615,15 @@ static int hdm_enqueue(struct most_interface *iface, int channel,
if (retval) {
dev_err(&mdev->usb_device->dev,
"URB submit failed with error %d.\n", retval);
goto _error_1;
goto err_unanchor_urb;
}
goto _exit;
goto unlock_io_mutex;

_error_1:
err_unanchor_urb:
usb_unanchor_urb(urb);
_error:
err_free_urb:
usb_free_urb(urb);
_exit:
unlock_io_mutex:
mutex_unlock(&mdev->io_mutex);
return retval;
}
Expand Down Expand Up @@ -1041,7 +1041,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
int ret = 0;

if (!mdev)
goto exit_ENOMEM;
goto err_out_of_memory;

usb_set_intfdata(interface, mdev);
num_endpoints = usb_iface_desc->desc.bNumEndpoints;
Expand Down Expand Up @@ -1073,22 +1073,22 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)

mdev->conf = kcalloc(num_endpoints, sizeof(*mdev->conf), GFP_KERNEL);
if (!mdev->conf)
goto exit_free;
goto err_free_mdev;

mdev->cap = kcalloc(num_endpoints, sizeof(*mdev->cap), GFP_KERNEL);
if (!mdev->cap)
goto exit_free1;
goto err_free_conf;

mdev->iface.channel_vector = mdev->cap;
mdev->ep_address =
kcalloc(num_endpoints, sizeof(*mdev->ep_address), GFP_KERNEL);
if (!mdev->ep_address)
goto exit_free2;
goto err_free_cap;

mdev->busy_urbs =
kcalloc(num_endpoints, sizeof(*mdev->busy_urbs), GFP_KERNEL);
if (!mdev->busy_urbs)
goto exit_free3;
goto err_free_ep_address;

tmp_cap = mdev->cap;
for (i = 0; i < num_endpoints; i++) {
Expand Down Expand Up @@ -1129,7 +1129,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)

ret = most_register_interface(&mdev->iface);
if (ret)
goto exit_free4;
goto err_free_busy_urbs;

mutex_lock(&mdev->io_mutex);
if (le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_OS81118 ||
Expand All @@ -1140,7 +1140,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
mutex_unlock(&mdev->io_mutex);
most_deregister_interface(&mdev->iface);
ret = -ENOMEM;
goto exit_free4;
goto err_free_busy_urbs;
}

mdev->dci->dev.init_name = "dci";
Expand All @@ -1150,25 +1150,25 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
mutex_unlock(&mdev->io_mutex);
most_deregister_interface(&mdev->iface);
ret = -ENOMEM;
goto exit_free5;
goto err_free_dci;
}
mdev->dci->usb_device = mdev->usb_device;
}
mutex_unlock(&mdev->io_mutex);
return 0;
exit_free5:
err_free_dci:
kfree(mdev->dci);
exit_free4:
err_free_busy_urbs:
kfree(mdev->busy_urbs);
exit_free3:
err_free_ep_address:
kfree(mdev->ep_address);
exit_free2:
err_free_cap:
kfree(mdev->cap);
exit_free1:
err_free_conf:
kfree(mdev->conf);
exit_free:
err_free_mdev:
kfree(mdev);
exit_ENOMEM:
err_out_of_memory:
if (ret == 0 || ret == -ENOMEM) {
ret = -ENOMEM;
dev_err(dev, "out of memory\n");
Expand Down

0 comments on commit bddd3c2

Please sign in to comment.