USB: gadget: android: Add NULL check for platform data of android_dev
Change-Id: I1b8fa1c985f17d3085076f6d4e77921b7ac6397a
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index 5e38238..a86e049 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -346,7 +346,7 @@
char *name;
char buf[32], *b;
int once = 0, err = -1;
- int (*notify)(uint32_t, const char *);
+ int (*notify)(uint32_t, const char *) = NULL;
strncpy(buf, diag_clients, sizeof(buf));
b = strim(buf);
@@ -354,10 +354,8 @@
while (b) {
name = strsep(&b, ",");
/* Allow only first diag channel to update pid and serial no */
- if (!once++)
+ if (_android_dev->pdata && !once++)
notify = _android_dev->pdata->update_pid_and_serial_num;
- else
- notify = NULL;
if (name) {
err = diag_function_add(c, name, notify);