mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 12:14:10 +08:00
leds: max8997: Don't error if there is no pdata
The driver works just fine if no platform data is supplied. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
This commit is contained in:
parent
fb0f4051ee
commit
57d91e0390
@ -238,11 +238,6 @@ static int max8997_led_probe(struct platform_device *pdev)
|
|||||||
char name[20];
|
char name[20];
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (pdata == NULL) {
|
|
||||||
dev_err(&pdev->dev, "no platform data\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL);
|
led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL);
|
||||||
if (led == NULL)
|
if (led == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -258,7 +253,7 @@ static int max8997_led_probe(struct platform_device *pdev)
|
|||||||
led->iodev = iodev;
|
led->iodev = iodev;
|
||||||
|
|
||||||
/* initialize mode and brightness according to platform_data */
|
/* initialize mode and brightness according to platform_data */
|
||||||
if (pdata->led_pdata) {
|
if (pdata && pdata->led_pdata) {
|
||||||
u8 mode = 0, brightness = 0;
|
u8 mode = 0, brightness = 0;
|
||||||
|
|
||||||
mode = pdata->led_pdata->mode[led->id];
|
mode = pdata->led_pdata->mode[led->id];
|
||||||
|
Loading…
Reference in New Issue
Block a user