summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorPaul Cercueil <paul@crapouillou.net>2022-10-20 13:44:42 +0200
committerPavel Machek <pavel@ucw.cz>2022-10-22 11:55:03 +0200
commit57d91e039070faa938622d28093ba1d031e29b3b (patch)
tree852c82085896a8da3161ffa6907686e6eb412f32 /drivers/leds
parentleds: lp55xx: remove variable j (diff)
downloadlinux-57d91e039070faa938622d28093ba1d031e29b3b.tar.xz
linux-57d91e039070faa938622d28093ba1d031e29b3b.zip
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>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-max8997.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/leds/leds-max8997.c b/drivers/leds/leds-max8997.c
index c0bddb33888d..c8d7f55c9dec 100644
--- a/drivers/leds/leds-max8997.c
+++ b/drivers/leds/leds-max8997.c
@@ -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;
@@ -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];