Skip to content

Commit 0bee70c

Browse files
author
Peter Chen
committed
ENGR00255484-1 msl: usb: add NULL poiner check for fsl_xcvr_ops
Add NULL pointer check for global fsl_xcvr_ops Signed-off-by: Peter Chen <[email protected]>
1 parent 213da8c commit 0bee70c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/arm/plat-mxc/usb_common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2011-2012 Freescale Semiconductor, Inc. All Rights Reserved.
2+
* Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -182,7 +182,7 @@ void fsl_usb_xcvr_unregister(struct fsl_xcvr_ops *xcvr_ops)
182182

183183
pr_debug("%s\n", __func__);
184184
for (i = 0; i < MXC_NUMBER_USB_TRANSCEIVER; i++) {
185-
if (g_xc_ops[i] == xcvr_ops) {
185+
if (g_xc_ops[i] && (g_xc_ops[i] == xcvr_ops)) {
186186
g_xc_ops[i] = NULL;
187187
return;
188188
}
@@ -203,7 +203,7 @@ static struct fsl_xcvr_ops *fsl_usb_get_xcvr(char *name)
203203
}
204204

205205
for (i = 0; i < MXC_NUMBER_USB_TRANSCEIVER; i++) {
206-
if (strcmp(g_xc_ops[i]->name, name) == 0) {
206+
if (g_xc_ops[i] && (strcmp(g_xc_ops[i]->name, name) == 0)) {
207207
return g_xc_ops[i];
208208
}
209209
}

0 commit comments

Comments
 (0)