Skip to content

Commit

Permalink
ENGR00255484-1 msl: usb: add NULL poiner check for fsl_xcvr_ops
Browse files Browse the repository at this point in the history
Add NULL pointer check for global fsl_xcvr_ops

Signed-off-by: Peter Chen <peter.chen@freescale.com>
  • Loading branch information
Peter Chen committed Mar 22, 2013
1 parent 213da8c commit 0bee70c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/arm/plat-mxc/usb_common.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2012 Freescale Semiconductor, Inc. All Rights Reserved.
* Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -182,7 +182,7 @@ void fsl_usb_xcvr_unregister(struct fsl_xcvr_ops *xcvr_ops)

pr_debug("%s\n", __func__);
for (i = 0; i < MXC_NUMBER_USB_TRANSCEIVER; i++) {
if (g_xc_ops[i] == xcvr_ops) {
if (g_xc_ops[i] && (g_xc_ops[i] == xcvr_ops)) {
g_xc_ops[i] = NULL;
return;
}
Expand All @@ -203,7 +203,7 @@ static struct fsl_xcvr_ops *fsl_usb_get_xcvr(char *name)
}

for (i = 0; i < MXC_NUMBER_USB_TRANSCEIVER; i++) {
if (strcmp(g_xc_ops[i]->name, name) == 0) {
if (g_xc_ops[i] && (strcmp(g_xc_ops[i]->name, name) == 0)) {
return g_xc_ops[i];
}
}
Expand Down

0 comments on commit 0bee70c

Please sign in to comment.