summaryrefslogtreecommitdiff
path: root/net/caif/caif_usb.c
diff options
context:
space:
mode:
authorMichael Bestas <mkbestas@lineageos.org>2021-07-10 21:26:34 +0300
committerMichael Bestas <mkbestas@lineageos.org>2021-07-10 21:26:34 +0300
commit3c741a8b469c522434e6841d8618702303fd6a21 (patch)
treef95f59bb8f761500862e72b98f9b266ecfdcc82e /net/caif/caif_usb.c
parentd46db1f472cf55742a7a2db10218cdcc084e0daf (diff)
parentb5f0035416310da3ccfaf160e6d856c294ec3bf5 (diff)
Merge branch 'android-4.4-p' of https://android.googlesource.com/kernel/common into lineage-18.1-caf-msm8998
This brings LA.UM.9.2.r1-03400-SDMxx0.0 up to date with https://android.googlesource.com/kernel/common/ android-4.4-p at commit: b5f0035416310 Merge 4.4.274 into android-4.4-p Conflicts: include/linux/spi/spi.h Change-Id: I3daac7891ee93c70ffe08b7e70b77e8b2989af67
Diffstat (limited to 'net/caif/caif_usb.c')
-rw-r--r--net/caif/caif_usb.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/net/caif/caif_usb.c b/net/caif/caif_usb.c
index 5cd44f001f64..485dde566c1a 100644
--- a/net/caif/caif_usb.c
+++ b/net/caif/caif_usb.c
@@ -116,6 +116,11 @@ static struct cflayer *cfusbl_create(int phyid, u8 ethaddr[ETH_ALEN],
return (struct cflayer *) this;
}
+static void cfusbl_release(struct cflayer *layer)
+{
+ kfree(layer);
+}
+
static struct packet_type caif_usb_type __read_mostly = {
.type = cpu_to_be16(ETH_P_802_EX1),
};
@@ -128,6 +133,7 @@ static int cfusbl_device_notify(struct notifier_block *me, unsigned long what,
struct cflayer *layer, *link_support;
struct usbnet *usbnet;
struct usb_device *usbdev;
+ int res;
/* Check whether we have a NCM device, and find its VID/PID. */
if (!(dev->dev.parent && dev->dev.parent->driver &&
@@ -170,8 +176,11 @@ static int cfusbl_device_notify(struct notifier_block *me, unsigned long what,
if (dev->num_tx_queues > 1)
pr_warn("USB device uses more than one tx queue\n");
- caif_enroll_dev(dev, &common, link_support, CFUSB_MAX_HEADLEN,
+ res = caif_enroll_dev(dev, &common, link_support, CFUSB_MAX_HEADLEN,
&layer, &caif_usb_type.func);
+ if (res)
+ goto err;
+
if (!pack_added)
dev_add_pack(&caif_usb_type);
pack_added = true;
@@ -181,6 +190,9 @@ static int cfusbl_device_notify(struct notifier_block *me, unsigned long what,
layer->name[sizeof(layer->name) - 1] = 0;
return 0;
+err:
+ cfusbl_release(link_support);
+ return res;
}
static struct notifier_block caif_device_notifier = {