diff options
author | Peter Chen <peter.chen@freescale.com> | 2015-02-11 05:44:44 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-18 16:19:08 +0100 |
commit | a4cf1b14cfbc57a12ea2d997b93735a99f70d810 (patch) | |
tree | 1c1a514500be4b0f290e9c9299575e3eb135f3c3 /drivers/usb/chipidea/usbmisc_imx.c | |
parent | usb: chipidea: usbmisc_imx: delete clock information (diff) | |
download | linux-a4cf1b14cfbc57a12ea2d997b93735a99f70d810.tar.xz linux-a4cf1b14cfbc57a12ea2d997b93735a99f70d810.zip |
usb: chipidea: imx: simplify the usbmisc callers
Move struct imx_usbmisc_data NULL pointer judgement from caller to
each API, it can simplify the caller.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea/usbmisc_imx.c')
-rw-r--r-- | drivers/usb/chipidea/usbmisc_imx.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 93856027d6f4..eb77e3285c8a 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -265,8 +265,12 @@ static const struct usbmisc_ops vf610_usbmisc_ops = { int imx_usbmisc_init(struct imx_usbmisc_data *data) { - struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); + struct imx_usbmisc *usbmisc; + + if (!data) + return 0; + usbmisc = dev_get_drvdata(data->dev); if (!usbmisc->ops->init) return 0; return usbmisc->ops->init(data); @@ -275,8 +279,12 @@ EXPORT_SYMBOL_GPL(imx_usbmisc_init); int imx_usbmisc_init_post(struct imx_usbmisc_data *data) { - struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); + struct imx_usbmisc *usbmisc; + + if (!data) + return 0; + usbmisc = dev_get_drvdata(data->dev); if (!usbmisc->ops->post) return 0; return usbmisc->ops->post(data); |