summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/function/f_mtp.c
diff options
context:
space:
mode:
authorAmit Pundir <amit.pundir@linaro.org>2015-08-11 12:34:45 +0530
committerDmitry Shmidt <dimitrysh@google.com>2016-11-15 12:51:09 -0800
commit0a60e50f0b910612c3f9560fc3a791e70d146b0b (patch)
tree1a4cbc9ee72c87d87ec20ea3c125fb3031e7c67f /drivers/usb/gadget/function/f_mtp.c
parent2182c4daf185176ac99bf71a4ae1786ea9620714 (diff)
usb: gadget: f_mtp: simplify ptp NULL pointer check
Simplify MTP/PTP dev NULL pointer check introduced in Change-Id: Ic44a699d96df2e13467fc081bff88b97dcc5afb2 and restrict it to MTP/PTP function level only. Return ERR_PTR() instead of NULL from mtp_ptp function to skip doing NULL pointer checks all the way up to configfs.c Fixes: Change-Id: Ic44a699d96df2e13467fc081bff88b97dcc5afb2 ("usb: gadget: fix NULL ptr derefer while symlinking PTP func") Change-Id: Iab7c55089c115550c3506f6cca960a07ae52713d Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Diffstat (limited to 'drivers/usb/gadget/function/f_mtp.c')
-rw-r--r--drivers/usb/gadget/function/f_mtp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_mtp.c b/drivers/usb/gadget/function/f_mtp.c
index 74195be9b054..b9e3e97c57c4 100644
--- a/drivers/usb/gadget/function/f_mtp.c
+++ b/drivers/usb/gadget/function/f_mtp.c
@@ -1498,7 +1498,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;