* [PATCH v2] leds: max8997: Don't error if there is no pdata
@ 2022-10-20 11:44 Paul Cercueil
2022-10-21 13:11 ` Pavel Machek
0 siblings, 1 reply; 4+ messages in thread
From: Paul Cercueil @ 2022-10-20 11:44 UTC (permalink / raw)
To: Pavel Machek; +Cc: linux-leds, linux-kernel, Paul Cercueil, Andy Shevchenko
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>
---
v2: Add Andy's reviewed-by and reword the commit description.
drivers/leds/leds-max8997.c | 7 +------
1 file changed, 1 insertion(+), 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];
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] leds: max8997: Don't error if there is no pdata
2022-10-20 11:44 [PATCH v2] leds: max8997: Don't error if there is no pdata Paul Cercueil
@ 2022-10-21 13:11 ` Pavel Machek
2022-10-21 13:19 ` Paul Cercueil
0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2022-10-21 13:11 UTC (permalink / raw)
To: Paul Cercueil; +Cc: linux-leds, linux-kernel, Andy Shevchenko
[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]
On Thu 2022-10-20 12:44:42, Paul Cercueil wrote:
> 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>
Does it? Bad Paul, bad Andy.
> +++ 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];
I see pdata being dereferenced here.
Pavel
--
People of Russia, stop Putin before his war on Ukraine escalates.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] leds: max8997: Don't error if there is no pdata
2022-10-21 13:11 ` Pavel Machek
@ 2022-10-21 13:19 ` Paul Cercueil
2022-10-22 9:55 ` Pavel Machek
0 siblings, 1 reply; 4+ messages in thread
From: Paul Cercueil @ 2022-10-21 13:19 UTC (permalink / raw)
To: Pavel Machek; +Cc: linux-leds, linux-kernel, Andy Shevchenko
Le ven. 21 oct. 2022 à 15:11:45 +0200, Pavel Machek <pavel@ucw.cz> a
écrit :
> On Thu 2022-10-20 12:44:42, Paul Cercueil wrote:
>> 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>
>
> Does it? Bad Paul, bad Andy.
Yes, it does.
>> +++ 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];
>
> I see pdata being dereferenced here.
Oh really. Look again.
-Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] leds: max8997: Don't error if there is no pdata
2022-10-21 13:19 ` Paul Cercueil
@ 2022-10-22 9:55 ` Pavel Machek
0 siblings, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2022-10-22 9:55 UTC (permalink / raw)
To: Paul Cercueil; +Cc: linux-leds, linux-kernel, Andy Shevchenko
[-- Attachment #1: Type: text/plain, Size: 416 bytes --]
Hi!
> > > 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>
> >
> > Does it? Bad Paul, bad Andy.
>
> Yes, it does.
Sorry, I misread the patch. Applied now.
Best regards,
Pavel
--
People of Russia, stop Putin before his war on Ukraine escalates.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-10-22 10:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-20 11:44 [PATCH v2] leds: max8997: Don't error if there is no pdata Paul Cercueil
2022-10-21 13:11 ` Pavel Machek
2022-10-21 13:19 ` Paul Cercueil
2022-10-22 9:55 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox