Skip to content

Commit

Permalink
leds: convert Atmel PWM LED driver to devm_kzalloc()
Browse files Browse the repository at this point in the history
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
  • Loading branch information
Bryan Wu committed Jul 23, 2012
1 parent 60a0aad commit 4aad381
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/leds/leds-atmel-pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ static int __devinit pwmled_probe(struct platform_device *pdev)
if (!pdata || pdata->num_leds < 1)
return -ENODEV;

leds = kcalloc(pdata->num_leds, sizeof(*leds), GFP_KERNEL);
leds = devm_kzalloc(&pdev->dev, pdata->num_leds * sizeof(*leds),
GFP_KERNEL);
if (!leds)
return -ENOMEM;

Expand Down Expand Up @@ -108,7 +109,6 @@ static int __devinit pwmled_probe(struct platform_device *pdev)
pwm_channel_free(&leds[i].pwmc);
}
}
kfree(leds);

return status;
}
Expand All @@ -129,7 +129,6 @@ static int __exit pwmled_remove(struct platform_device *pdev)
pwm_channel_free(&led->pwmc);
}

kfree(leds);
platform_set_drvdata(pdev, NULL);
return 0;
}
Expand Down

0 comments on commit 4aad381

Please sign in to comment.