Skip to content

Commit

Permalink
leds-lp8788: fix a parent device in _probe()
Browse files Browse the repository at this point in the history
The lp8788-keyled is a platform driver of lp8788-mfd. The platform
device is allocated when mfd_add_devices() is called in lp8788-mfd.
On the other hand, 'lp->dev' is the i2c client device.

Therefore, this 'platform_device' is a proper parent device in case
of resource managed mem alloc, registering led device and device
kernel messages.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
  • Loading branch information
Kim, Milo authored and Bryan Wu committed Feb 2, 2013
1 parent 08541cb commit a1932ed
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/leds/leds-lp8788.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ static int lp8788_led_probe(struct platform_device *pdev)
struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent);
struct lp8788_led_platform_data *led_pdata;
struct lp8788_led *led;
struct device *dev = &pdev->dev;
int ret;

led = devm_kzalloc(lp->dev, sizeof(struct lp8788_led), GFP_KERNEL);
led = devm_kzalloc(dev, sizeof(struct lp8788_led), GFP_KERNEL);
if (!led)
return -ENOMEM;

Expand All @@ -154,13 +155,13 @@ static int lp8788_led_probe(struct platform_device *pdev)

ret = lp8788_led_init_device(led, led_pdata);
if (ret) {
dev_err(lp->dev, "led init device err: %d\n", ret);
dev_err(dev, "led init device err: %d\n", ret);
return ret;
}

ret = led_classdev_register(lp->dev, &led->led_dev);
ret = led_classdev_register(dev, &led->led_dev);
if (ret) {
dev_err(lp->dev, "led register err: %d\n", ret);
dev_err(dev, "led register err: %d\n", ret);
return ret;
}

Expand Down

0 comments on commit a1932ed

Please sign in to comment.