[RAMEN9610-14956] [COMMON] usb: check android device and UDC name
authorKisang Lee <kisang80.lee@samsung.com>
Tue, 7 May 2019 12:15:55 +0000 (21:15 +0900)
committerKim Gunho <gunho.kim@samsung.com>
Fri, 28 Jun 2019 14:44:57 +0000 (23:44 +0900)
Change-Id: I5750a0da33aec22fde3050a9f3db4161196f8394
Signed-off-by: Kisang Lee <kisang80.lee@samsung.com>
drivers/usb/gadget/configfs.c
drivers/usb/gadget/function/f_fs.c

index 8c8423885827916eb717065c7c45157546a60292..a31af00e486d3416b73d971ff2ae717ef0984811 100644 (file)
@@ -324,6 +324,12 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item,
        name = kstrdup(page, GFP_KERNEL);
        if (!name)
                return -ENOMEM;
+
+       if(!len || (strlen(name) != len)) {
+               kfree(name);
+               return -EINVAL;
+       }
+
        if (name[len - 1] == '\n')
                name[len - 1] = '\0';
 
@@ -1455,6 +1461,11 @@ static void android_work(struct work_struct *data)
        unsigned long flags;
        bool uevent_sent = false;
 
+       if (!android_device && IS_ERR(android_device)) {
+               pr_info("usb: cannot send uevent because android_device not available \n");
+               return;
+       }
+
        spin_lock_irqsave(&cdev->lock, flags);
        if (cdev->config)
                status[1] = true;
index ccf218e7849e991268b219be2baaf4d5de2a2825..0ca1a242ae5eae8bbf82206694c62044e2429ba3 100644 (file)
@@ -2939,8 +2939,6 @@ static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f,
        if (ret)
                return ERR_PTR(ret);
 
-       pr_info("KS : No waiting!!!\n");
-
        func->conf = c;
        func->gadget = c->cdev->gadget;