usb: chipidea: fix static checker warning for NULL pointer
Greg Kroah-Hartman
maintainerPATCH 1/1 usb: chipidea: fix static checker warning for NULL pointer
Quoted 1 line · Peter Chen
During the static checker, "
data->usbmisc_data" may be NULL.
I can not quite parse this sentance. Do you mean that a static checker found this issue?
Quoted 13 lines
Fix it by adding this pointer judgement before using.
Reported-by Dan Carpenter <[email protected]>Signed-off-by Peter Chen <[email protected]>--- drivers/usb/chipidea/ci_hdrc_imx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/usb/chipidea/ci_hdrc_imx.c +0
-0
drivers/usb/chipidea/ci_hdrc_imx.c static int ci_hdrc_imx_probe(struct platform_device *pdev) · line 320
Quoted 6 lines
drivers/usb/chipidea/ci_hdrc_imx.c +2
-1@@ -316,7 +316,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)if (IS_ERR (data->usbmisc_data))return PTR_ERR (data->usbmisc_data); -if (of_usb_get_phy_mode (dev->of_node) ==USBPHY_INTERFACE_MODE_HSIC ) { +if ((of_usb_get_phy_mode (dev->of_node) ==USBPHY_INTERFACE_MODE_HSIC ) + && data->usbmisc_data) {
Are you sure that is correct? If usbmisc_data is NULL, then you just took out a bunch of checking and lookups. Don't you normally need to do this even if that pointer is NULL?
Will the rest of the function still work properly if that is the case?
thanks,
greg k-h