Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308953
b: refs/heads/master
c: 58875ea
h: refs/heads/master
i:
  308951: 180114e
v: v3
  • Loading branch information
Jingoo Han authored and Linus Torvalds committed May 29, 2012
1 parent f1b30cf commit 2cea331
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f5f4fd451634e5295cc807684a0eabd264b9db4d
refs/heads/master: 58875ea925763e99b8862dc07bcdebde774d830b
22 changes: 7 additions & 15 deletions trunk/drivers/video/backlight/adp8860_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ static int __devinit adp8860_led_probe(struct i2c_client *client)
struct led_info *cur_led;
int ret, i;

led = kzalloc(sizeof(*led) * pdata->num_leds, GFP_KERNEL);
led = devm_kzalloc(&client->dev, sizeof(*led) * pdata->num_leds,
GFP_KERNEL);
if (led == NULL) {
dev_err(&client->dev, "failed to alloc memory\n");
return -ENOMEM;
Expand All @@ -236,7 +237,7 @@ static int __devinit adp8860_led_probe(struct i2c_client *client)

if (ret) {
dev_err(&client->dev, "failed to write\n");
goto err_free;
return ret;
}

for (i = 0; i < pdata->num_leds; ++i) {
Expand Down Expand Up @@ -291,9 +292,6 @@ static int __devinit adp8860_led_probe(struct i2c_client *client)
cancel_work_sync(&led[i].work);
}

err_free:
kfree(led);

return ret;
}

Expand All @@ -309,7 +307,6 @@ static int __devexit adp8860_led_remove(struct i2c_client *client)
cancel_work_sync(&data->led[i].work);
}

kfree(data->led);
return 0;
}
#else
Expand Down Expand Up @@ -675,13 +672,13 @@ static int __devinit adp8860_probe(struct i2c_client *client,
return -EINVAL;
}

data = kzalloc(sizeof(*data), GFP_KERNEL);
data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
if (data == NULL)
return -ENOMEM;

ret = adp8860_read(client, ADP8860_MFDVID, &reg_val);
if (ret < 0)
goto out2;
return ret;

switch (ADP8860_MANID(reg_val)) {
case ADP8863_MANUFID:
Expand All @@ -694,8 +691,7 @@ static int __devinit adp8860_probe(struct i2c_client *client,
break;
default:
dev_err(&client->dev, "failed to probe\n");
ret = -ENODEV;
goto out2;
return -ENODEV;
}

/* It's confirmed that the DEVID field is actually a REVID */
Expand All @@ -717,8 +713,7 @@ static int __devinit adp8860_probe(struct i2c_client *client,
&client->dev, data, &adp8860_bl_ops, &props);
if (IS_ERR(bl)) {
dev_err(&client->dev, "failed to register backlight\n");
ret = PTR_ERR(bl);
goto out2;
return PTR_ERR(bl);
}

bl->props.brightness = ADP8860_MAX_BRIGHTNESS;
Expand Down Expand Up @@ -756,8 +751,6 @@ static int __devinit adp8860_probe(struct i2c_client *client,
&adp8860_bl_attr_group);
out1:
backlight_device_unregister(bl);
out2:
kfree(data);

return ret;
}
Expand All @@ -776,7 +769,6 @@ static int __devexit adp8860_remove(struct i2c_client *client)
&adp8860_bl_attr_group);

backlight_device_unregister(data->bl);
kfree(data);

return 0;
}
Expand Down

0 comments on commit 2cea331

Please sign in to comment.