summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2021-05-19 14:47:17 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-03 08:59:16 +0200
commit3c36980ba68172d623da8427a7dc81257bba4f1c (patch)
treea6693b7b4165c6c10696f021d906bd66dcc7c596
parent1bd48a2af84e9eec0139cb73de4c26b5cbe8d78e (diff)
net: hso: bail out on interrupt URB allocation failure
commit 4d52ebc7ace491d58f96d1f4a1cb9070c506b2e7 upstream. Commit 31db0dbd7244 ("net: hso: check for allocation failure in hso_create_bulk_serial_device()") recently started returning an error when the driver fails to allocate resources for the interrupt endpoint and tiocmget functionality. For consistency let's bail out from probe also if the URB allocation fails. Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/usb/hso.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 0436e1661096..22450c4a9225 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2636,14 +2636,14 @@ static struct hso_device *hso_create_bulk_serial_device(
}
tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL);
- if (tiocmget->urb) {
- mutex_init(&tiocmget->mutex);
- init_waitqueue_head(&tiocmget->waitq);
- } else
- hso_free_tiomget(serial);
- }
- else
+ if (!tiocmget->urb)
+ goto exit;
+
+ mutex_init(&tiocmget->mutex);
+ init_waitqueue_head(&tiocmget->waitq);
+ } else {
num_urbs = 1;
+ }
if (hso_serial_common_create(serial, num_urbs, BULK_URB_RX_SIZE,
BULK_URB_TX_SIZE))