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:
Paul Cercueil 2022-10-20 12:44:42 +01:00 committed by Pavel Machek
parent fb0f4051ee
commit 57d91e0390

View File

@ -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];