{
struct usb3503_platform_data *pdata = i2c->dev.platform_data;
struct usb3503 *hub;
- int err;
+ int err = -ENOMEM;
hub = kzalloc(sizeof(struct usb3503), GFP_KERNEL);
if (!hub) {
dev_err(&i2c->dev, "private data alloc fail\n");
- return -ENOMEM;
+ return err;
}
i2c_set_clientdata(i2c, hub);
if (!pdata) {
dev_dbg(&i2c->dev, "missing platform data\n");
+ goto err_out;
} else {
hub->gpio_intn = pdata->gpio_intn;
hub->gpio_connect = pdata->gpio_connect;
dev_err(&i2c->dev,
"unable to request GPIO %d as connect pin (%d)\n",
hub->gpio_intn, err);
- goto err_gpio_intn;
+ goto err_out;
}
}
err_gpio_connect:
if (gpio_is_valid(hub->gpio_intn))
gpio_free(hub->gpio_intn);
-err_gpio_intn:
+err_out:
kfree(hub);
return err;