Skip to content

Commit 57d91e0

Browse files
pcercueipavelmachek
authored andcommitted
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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
1 parent fb0f405 commit 57d91e0

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

drivers/leds/leds-max8997.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,6 @@ static int max8997_led_probe(struct platform_device *pdev)
238238
char name[20];
239239
int ret = 0;
240240

241-
if (pdata == NULL) {
242-
dev_err(&pdev->dev, "no platform data\n");
243-
return -ENODEV;
244-
}
245-
246241
led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL);
247242
if (led == NULL)
248243
return -ENOMEM;
@@ -258,7 +253,7 @@ static int max8997_led_probe(struct platform_device *pdev)
258253
led->iodev = iodev;
259254

260255
/* initialize mode and brightness according to platform_data */
261-
if (pdata->led_pdata) {
256+
if (pdata && pdata->led_pdata) {
262257
u8 mode = 0, brightness = 0;
263258

264259
mode = pdata->led_pdata->mode[led->id];

0 commit comments

Comments
 (0)