netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum-IBi9RG/b67k@public.gmane.org>
To: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	gregKH-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	bjorn-yOkvZcmFvRU@public.gmane.org
Cc: Oliver Neukum <oneukum-IBi9RG/b67k@public.gmane.org>,
	Oliver Neukum <ONeukum-IBi9RG/b67k@public.gmane.org>
Subject: [PATCH 3/5] cdc-acm: cleanup error handling
Date: Thu, 14 Jul 2016 15:41:32 +0200	[thread overview]
Message-ID: <1468503694-9482-4-git-send-email-oneukum@suse.com> (raw)
In-Reply-To: <1468503694-9482-1-git-send-email-oneukum-IBi9RG/b67k@public.gmane.org>

A small update to unify error handling during probe().

Signed-off-by: Oliver Neukum <ONeukum-IBi9RG/b67k@public.gmane.org>
---
 drivers/usb/class/cdc-acm.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 70bd642..1857fad 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1328,11 +1328,8 @@ made_compressed_probe:
 		goto alloc_fail;
 
 	minor = acm_alloc_minor(acm);
-	if (minor < 0) {
-		dev_err(&intf->dev, "no more free acm devices\n");
-		kfree(acm);
-		return -ENODEV;
-	}
+	if (minor < 0)
+		goto alloc_fail1;
 
 	ctrlsize = usb_endpoint_maxp(epctrl);
 	readsize = usb_endpoint_maxp(epread) *
@@ -1523,6 +1520,7 @@ alloc_fail4:
 	usb_free_coherent(usb_dev, ctrlsize, acm->ctrl_buffer, acm->ctrl_dma);
 alloc_fail2:
 	acm_release_minor(acm);
+alloc_fail1:
 	kfree(acm);
 alloc_fail:
 	return rv;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-07-14 13:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-14 13:41 [PATCH 0 / 5] move the common CDC parser Oliver Neukum
2016-07-14 13:41 ` [PATCH 1/5] usbnet: move the CDC parser into USB core Oliver Neukum
2016-07-14 13:41 ` [PATCH 4/5] cdc-wdm: use the common CDC parser Oliver Neukum
     [not found] ` <1468503694-9482-1-git-send-email-oneukum-IBi9RG/b67k@public.gmane.org>
2016-07-14 13:41   ` [PATCH 2/5] cdc-acm: use the common parser Oliver Neukum
2016-07-14 13:41   ` Oliver Neukum [this message]
2016-07-14 13:41   ` [PATCH 5/5] cdc-acm: beautify probe() Oliver Neukum
2016-07-15 18:51 ` [PATCH 0 / 5] move the common CDC parser David Miller
     [not found]   ` <20160715.115147.1896139966807241395.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2016-07-15 21:57     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1468503694-9482-4-git-send-email-oneukum@suse.com \
    --to=oneukum-ibi9rg/b67k@public.gmane.org \
    --cc=bjorn-yOkvZcmFvRU@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=gregKH-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).