Skip to content

Commit

Permalink
leds: max8997: Don't error if there is no pdata
Browse files Browse the repository at this point in the history
The driver works just fine if no platform data is supplied.

Signed-off-by: Paul Cercueil <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
  • Loading branch information
pcercuei authored and pavelmachek committed Oct 22, 2022
1 parent fb0f405 commit 57d91e0
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/leds/leds-max8997.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,6 @@ static int max8997_led_probe(struct platform_device *pdev)
char name[20];
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);
if (led == NULL)
return -ENOMEM;
Expand All @@ -258,7 +253,7 @@ static int max8997_led_probe(struct platform_device *pdev)
led->iodev = iodev;

/* initialize mode and brightness according to platform_data */
if (pdata->led_pdata) {
if (pdata && pdata->led_pdata) {
u8 mode = 0, brightness = 0;

mode = pdata->led_pdata->mode[led->id];
Expand Down

0 comments on commit 57d91e0

Please sign in to comment.