Commit bddd3c25 authored by Christian Gromm's avatar Christian Gromm Committed by Greg Kroah-Hartman
Browse files

staging: most: fix label names



This patch makes use of label names that say what the goto
actually does, as recommended in the kernel documentation.

Signed-off-by: default avatarChristian Gromm <christian.gromm@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bfeb67ed
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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);
@@ -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);
@@ -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;
}
+12 −12
Original line number Diff line number Diff line
@@ -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);
@@ -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;
@@ -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;
@@ -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
@@ -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);
@@ -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;
}
+23 −23
Original line number Diff line number Diff line
@@ -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;
@@ -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;
}
@@ -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;
@@ -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++) {
@@ -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 ||
@@ -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";
@@ -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");