Skip to content

Commit

Permalink
lp8788-charger: Fix a parent device in _probe()
Browse files Browse the repository at this point in the history
The lp8788-charger 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 and device kernel message.

Signed-off-by: Milo(Woogyom) Kim <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
  • Loading branch information
Kim, Milo authored and enomsg committed Jan 6, 2013
1 parent ffd8f9a commit 05ac539
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/power/lp8788-charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,10 @@ static int lp8788_charger_probe(struct platform_device *pdev)
{
struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent);
struct lp8788_charger *pchg;
struct device *dev = &pdev->dev;
int ret;

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

Expand All @@ -718,7 +719,7 @@ static int lp8788_charger_probe(struct platform_device *pdev)

ret = lp8788_irq_register(pdev, pchg);
if (ret)
dev_warn(lp->dev, "failed to register charger irq: %d\n", ret);
dev_warn(dev, "failed to register charger irq: %d\n", ret);

return 0;
}
Expand Down

0 comments on commit 05ac539

Please sign in to comment.