Commit 7a8ea7eb authored by Dongjin Kim's avatar Dongjin Kim Committed by Greg Kroah-Hartman

USB: misc: fixup smatch WARNING

This patch fixes the warning,

6a099c63 [4/10] USB: misc: Add USB3503 High-Speed Hub Controller

drivers/usb/misc/usb3503.c:238 usb3503_probe() error: we previously assumed 'pdata' could be null (see line 196)
Signed-off-by: default avatarDongjin Kim <tobetter@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 74ff31b8
...@@ -182,12 +182,12 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id) ...@@ -182,12 +182,12 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
{ {
struct usb3503_platform_data *pdata = i2c->dev.platform_data; struct usb3503_platform_data *pdata = i2c->dev.platform_data;
struct usb3503 *hub; struct usb3503 *hub;
int err; int err = -ENOMEM;
hub = kzalloc(sizeof(struct usb3503), GFP_KERNEL); hub = kzalloc(sizeof(struct usb3503), GFP_KERNEL);
if (!hub) { if (!hub) {
dev_err(&i2c->dev, "private data alloc fail\n"); dev_err(&i2c->dev, "private data alloc fail\n");
return -ENOMEM; return err;
} }
i2c_set_clientdata(i2c, hub); i2c_set_clientdata(i2c, hub);
...@@ -195,6 +195,7 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id) ...@@ -195,6 +195,7 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
if (!pdata) { if (!pdata) {
dev_dbg(&i2c->dev, "missing platform data\n"); dev_dbg(&i2c->dev, "missing platform data\n");
goto err_out;
} else { } else {
hub->gpio_intn = pdata->gpio_intn; hub->gpio_intn = pdata->gpio_intn;
hub->gpio_connect = pdata->gpio_connect; hub->gpio_connect = pdata->gpio_connect;
...@@ -209,7 +210,7 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id) ...@@ -209,7 +210,7 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
dev_err(&i2c->dev, dev_err(&i2c->dev,
"unable to request GPIO %d as connect pin (%d)\n", "unable to request GPIO %d as connect pin (%d)\n",
hub->gpio_intn, err); hub->gpio_intn, err);
goto err_gpio_intn; goto err_out;
} }
} }
...@@ -248,7 +249,7 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id) ...@@ -248,7 +249,7 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
err_gpio_connect: err_gpio_connect:
if (gpio_is_valid(hub->gpio_intn)) if (gpio_is_valid(hub->gpio_intn))
gpio_free(hub->gpio_intn); gpio_free(hub->gpio_intn);
err_gpio_intn: err_out:
kfree(hub); kfree(hub);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment