Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
[firefly-linux-kernel-4.4.55.git] / drivers / usb / gadget / function / f_mtp.c
index 23f866f391073aa851e81fd9f737a5e5e2eab4cb..e37ece7b6e3ea632d131174c4cd17af5dd4d81d1 100644 (file)
@@ -361,6 +361,7 @@ static inline struct mtp_dev *func_to_mtp(struct usb_function *f)
 static struct usb_request *mtp_request_new(struct usb_ep *ep, int buffer_size)
 {
        struct usb_request *req = usb_ep_alloc_request(ep, GFP_KERNEL);
+
        if (!req)
                return NULL;
 
@@ -1143,6 +1144,7 @@ static int mtp_ctrlrequest(struct usb_composite_dev *cdev,
                } else if (ctrl->bRequest == MTP_REQ_GET_DEVICE_STATUS
                                && w_index == 0 && w_value == 0) {
                        struct mtp_device_status *status = cdev->req->buf;
+
                        status->wLength =
                                __constant_cpu_to_le16(sizeof(*status));
 
@@ -1165,6 +1167,7 @@ static int mtp_ctrlrequest(struct usb_composite_dev *cdev,
        /* respond with data transfer or status phase? */
        if (value >= 0) {
                int rc;
+
                cdev->req->zero = value < w_length;
                cdev->req->length = value;
                rc = usb_ep_queue(cdev->gadget->ep0, cdev->req, GFP_ATOMIC);
@@ -1400,6 +1403,7 @@ static struct mtp_instance *to_mtp_instance(struct config_item *item)
 static void mtp_attr_release(struct config_item *item)
 {
        struct mtp_instance *fi_mtp = to_mtp_instance(item);
+
        usb_put_function_instance(&fi_mtp->func_inst);
 }
 
@@ -1520,7 +1524,7 @@ struct usb_function *function_alloc_mtp_ptp(struct usb_function_instance *fi,
                pr_err("\t2: Create MTP function\n");
                pr_err("\t3: Create and symlink PTP function"
                                " with a gadget configuration\n");
-               return NULL;
+               return ERR_PTR(-EINVAL); /* Invalid Configuration */
        }
 
        dev = fi_mtp->dev;