Loading drivers/leds/leds-lp5523.c +10 −14 Original line number Diff line number Diff line Loading @@ -877,7 +877,7 @@ static int __devinit lp5523_probe(struct i2c_client *client, struct lp5523_platform_data *pdata; int ret, i, led; chip = kzalloc(sizeof(*chip), GFP_KERNEL); chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); if (!chip) return -ENOMEM; Loading @@ -888,8 +888,7 @@ static int __devinit lp5523_probe(struct i2c_client *client, if (!pdata) { dev_err(&client->dev, "no platform data\n"); ret = -EINVAL; goto fail1; return -EINVAL; } mutex_init(&chip->lock); Loading @@ -899,7 +898,7 @@ static int __devinit lp5523_probe(struct i2c_client *client, if (pdata->setup_resources) { ret = pdata->setup_resources(); if (ret < 0) goto fail1; return ret; } if (pdata->enable) { Loading @@ -916,7 +915,7 @@ static int __devinit lp5523_probe(struct i2c_client *client, */ ret = lp5523_detect(client); if (ret) goto fail2; goto fail1; dev_info(&client->dev, "LP5523 Programmable led chip found\n"); Loading @@ -925,13 +924,13 @@ static int __devinit lp5523_probe(struct i2c_client *client, ret = lp5523_init_engine(&chip->engines[i], i + 1); if (ret) { dev_err(&client->dev, "error initializing engine\n"); goto fail2; goto fail1; } } ret = lp5523_configure(client); if (ret < 0) { dev_err(&client->dev, "error configuring chip\n"); goto fail2; goto fail1; } /* Initialize leds */ Loading @@ -949,7 +948,7 @@ static int __devinit lp5523_probe(struct i2c_client *client, ret = lp5523_init_led(&chip->leds[led], &client->dev, i, pdata); if (ret) { dev_err(&client->dev, "error initializing leds\n"); goto fail3; goto fail2; } chip->num_leds++; Loading @@ -965,21 +964,19 @@ static int __devinit lp5523_probe(struct i2c_client *client, ret = lp5523_register_sysfs(client); if (ret) { dev_err(&client->dev, "registering sysfs failed\n"); goto fail3; goto fail2; } return ret; fail3: fail2: for (i = 0; i < chip->num_leds; i++) { led_classdev_unregister(&chip->leds[i].cdev); cancel_work_sync(&chip->leds[i].brightness_work); } fail2: fail1: if (pdata->enable) pdata->enable(0); if (pdata->release_resources) pdata->release_resources(); fail1: kfree(chip); return ret; } Loading @@ -999,7 +996,6 @@ static int lp5523_remove(struct i2c_client *client) chip->pdata->enable(0); if (chip->pdata->release_resources) chip->pdata->release_resources(); kfree(chip); return 0; } Loading Loading
drivers/leds/leds-lp5523.c +10 −14 Original line number Diff line number Diff line Loading @@ -877,7 +877,7 @@ static int __devinit lp5523_probe(struct i2c_client *client, struct lp5523_platform_data *pdata; int ret, i, led; chip = kzalloc(sizeof(*chip), GFP_KERNEL); chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); if (!chip) return -ENOMEM; Loading @@ -888,8 +888,7 @@ static int __devinit lp5523_probe(struct i2c_client *client, if (!pdata) { dev_err(&client->dev, "no platform data\n"); ret = -EINVAL; goto fail1; return -EINVAL; } mutex_init(&chip->lock); Loading @@ -899,7 +898,7 @@ static int __devinit lp5523_probe(struct i2c_client *client, if (pdata->setup_resources) { ret = pdata->setup_resources(); if (ret < 0) goto fail1; return ret; } if (pdata->enable) { Loading @@ -916,7 +915,7 @@ static int __devinit lp5523_probe(struct i2c_client *client, */ ret = lp5523_detect(client); if (ret) goto fail2; goto fail1; dev_info(&client->dev, "LP5523 Programmable led chip found\n"); Loading @@ -925,13 +924,13 @@ static int __devinit lp5523_probe(struct i2c_client *client, ret = lp5523_init_engine(&chip->engines[i], i + 1); if (ret) { dev_err(&client->dev, "error initializing engine\n"); goto fail2; goto fail1; } } ret = lp5523_configure(client); if (ret < 0) { dev_err(&client->dev, "error configuring chip\n"); goto fail2; goto fail1; } /* Initialize leds */ Loading @@ -949,7 +948,7 @@ static int __devinit lp5523_probe(struct i2c_client *client, ret = lp5523_init_led(&chip->leds[led], &client->dev, i, pdata); if (ret) { dev_err(&client->dev, "error initializing leds\n"); goto fail3; goto fail2; } chip->num_leds++; Loading @@ -965,21 +964,19 @@ static int __devinit lp5523_probe(struct i2c_client *client, ret = lp5523_register_sysfs(client); if (ret) { dev_err(&client->dev, "registering sysfs failed\n"); goto fail3; goto fail2; } return ret; fail3: fail2: for (i = 0; i < chip->num_leds; i++) { led_classdev_unregister(&chip->leds[i].cdev); cancel_work_sync(&chip->leds[i].brightness_work); } fail2: fail1: if (pdata->enable) pdata->enable(0); if (pdata->release_resources) pdata->release_resources(); fail1: kfree(chip); return ret; } Loading @@ -999,7 +996,6 @@ static int lp5523_remove(struct i2c_client *client) chip->pdata->enable(0); if (chip->pdata->release_resources) chip->pdata->release_resources(); kfree(chip); return 0; } Loading