Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80c1bce9 authored by Markus Elfring's avatar Markus Elfring Committed by Mauro Carvalho Chehab
Browse files

[media] au0828: Refactoring for start_urb_transfer()



This issue was detected by using the Coccinelle software.

1. Let us return directly if a buffer allocation failed.

2. Delete the jump label "err" then.

3. Drop the explicit initialisation for the variable "ret"
   at the beginning.

4. Return zero as a constant at the end.

Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 490ba9c2
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ static int stop_urb_transfer(struct au0828_dev *dev)
static int start_urb_transfer(struct au0828_dev *dev)
{
	struct urb *purb;
	int i, ret = -ENOMEM;
	int i, ret;

	dprintk(2, "%s()\n", __func__);

@@ -194,7 +194,7 @@ static int start_urb_transfer(struct au0828_dev *dev)

		dev->urbs[i] = usb_alloc_urb(0, GFP_KERNEL);
		if (!dev->urbs[i])
			goto err;
			return -ENOMEM;

		purb = dev->urbs[i];

@@ -207,9 +207,10 @@ static int start_urb_transfer(struct au0828_dev *dev)
		if (!purb->transfer_buffer) {
			usb_free_urb(purb);
			dev->urbs[i] = NULL;
			ret = -ENOMEM;
			pr_err("%s: failed big buffer allocation, err = %d\n",
			       __func__, ret);
			goto err;
			return ret;
		}

		purb->status = -EINPROGRESS;
@@ -235,10 +236,7 @@ static int start_urb_transfer(struct au0828_dev *dev)
	}

	dev->urb_streaming = true;
	ret = 0;

err:
	return ret;
	return 0;
}

static void au0828_start_transport(struct au0828_dev *dev)