kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pcmcia/electra_cf: Fix some return values in 'electra_cf_probe()' in case of error
@ 2020-06-17 19:53 Christophe JAILLET
  2020-06-17 20:10 ` Olof Johansson
  2020-12-05  8:31 ` Dominik Brodowski
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2020-06-17 19:53 UTC (permalink / raw)
  To: linux, akpm, peterz, olof, hch
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET

'status' is known to be 0 at this point. It must be set to a meaningful
value in order to return an error code if one of the 'of_get_property()'
call fails.

Return -EINVAL in such a case.

Fixes: 2b571a066a2f("pcmcia: CompactFlash driver for PA Semi Electra boards")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/pcmcia/electra_cf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
index 35158cfd9c1a..40a5cffe24a4 100644
--- a/drivers/pcmcia/electra_cf.c
+++ b/drivers/pcmcia/electra_cf.c
@@ -229,6 +229,8 @@ static int electra_cf_probe(struct platform_device *ofdev)
 
 	cf->socket.pci_irq = cf->irq;
 
+	status = -EINVAL;
+
 	prop = of_get_property(np, "card-detect-gpio", NULL);
 	if (!prop)
 		goto fail1;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pcmcia/electra_cf: Fix some return values in 'electra_cf_probe()' in case of error
  2020-06-17 19:53 [PATCH] pcmcia/electra_cf: Fix some return values in 'electra_cf_probe()' in case of error Christophe JAILLET
@ 2020-06-17 20:10 ` Olof Johansson
  2020-06-17 20:27   ` Christophe JAILLET
  2020-12-05  8:31 ` Dominik Brodowski
  1 sibling, 1 reply; 4+ messages in thread
From: Olof Johansson @ 2020-06-17 20:10 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Dominik Brodowski, Andrew Morton, Peter Zijlstra,
	Christoph Hellwig, Linux Kernel Mailing List, kernel-janitors

On Wed, Jun 17, 2020 at 12:54 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> 'status' is known to be 0 at this point. It must be set to a meaningful
> value in order to return an error code if one of the 'of_get_property()'
> call fails.
>
> Return -EINVAL in such a case.
>
> Fixes: 2b571a066a2f("pcmcia: CompactFlash driver for PA Semi Electra boards")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/pcmcia/electra_cf.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
> index 35158cfd9c1a..40a5cffe24a4 100644
> --- a/drivers/pcmcia/electra_cf.c
> +++ b/drivers/pcmcia/electra_cf.c
> @@ -229,6 +229,8 @@ static int electra_cf_probe(struct platform_device *ofdev)
>
>         cf->socket.pci_irq = cf->irq;
>
> +       status = -EINVAL;
> +
>         prop = of_get_property(np, "card-detect-gpio", NULL);
>         if (!prop)
>                 goto fail1;

The pcmcia_register_socket() call site sets status explicitly before
jumping to fail1, which is a bit clearer.

Still, this is a legacy driver, I'm not sure there are any active
users of it these days, and surely nobody that's tinkering around and
editing the device tree (it comes from CFE on these systems, not from
a .dts in the kernel tree). The fix isn't invalid, but it's also not
likely to be an issue in the real world. So, let's just say:

Acked-by: Olof Johansson <olof@lixom.net>


-Olof

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pcmcia/electra_cf: Fix some return values in 'electra_cf_probe()' in case of error
  2020-06-17 20:10 ` Olof Johansson
@ 2020-06-17 20:27   ` Christophe JAILLET
  0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2020-06-17 20:27 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Dominik Brodowski, Andrew Morton, Peter Zijlstra,
	Christoph Hellwig, Linux Kernel Mailing List, kernel-janitors

Le 17/06/2020 à 22:10, Olof Johansson a écrit :
> On Wed, Jun 17, 2020 at 12:54 PM Christophe JAILLET
> <christophe.jaillet@wanadoo.fr> wrote:
>> 'status' is known to be 0 at this point. It must be set to a meaningful
>> value in order to return an error code if one of the 'of_get_property()'
>> call fails.
>>
>> Return -EINVAL in such a case.
>>
>> Fixes: 2b571a066a2f("pcmcia: CompactFlash driver for PA Semi Electra boards")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>>   drivers/pcmcia/electra_cf.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
>> index 35158cfd9c1a..40a5cffe24a4 100644
>> --- a/drivers/pcmcia/electra_cf.c
>> +++ b/drivers/pcmcia/electra_cf.c
>> @@ -229,6 +229,8 @@ static int electra_cf_probe(struct platform_device *ofdev)
>>
>>          cf->socket.pci_irq = cf->irq;
>>
>> +       status = -EINVAL;
>> +
>>          prop = of_get_property(np, "card-detect-gpio", NULL);
>>          if (!prop)
>>                  goto fail1;
> The pcmcia_register_socket() call site sets status explicitly before
> jumping to fail1, which is a bit clearer.

Agreed, but as as you say below, this is not the most active driver in 
the kernel and PCMCIA, well, does anyone still uses it?

> Still, this is a legacy driver, I'm not sure there are any active
> users of it these days, and surely nobody that's tinkering around and
> editing the device tree (it comes from CFE on these systems, not from
> a .dts in the kernel tree). The fix isn't invalid, but it's also not
> likely to be an issue in the real world. So, let's just say:

In fact this patch has been in my tree for years, because the driver is 
mostly untouched and certainly used by no one, nowadays.
However, 2 weeks ago, commit b274014c6d19 made me think of a revived 
interest.
So I decided to post the patch, just in case.

> Acked-by: Olof Johansson <olof@lixom.net>
>
>
> -Olof
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pcmcia/electra_cf: Fix some return values in 'electra_cf_probe()' in case of error
  2020-06-17 19:53 [PATCH] pcmcia/electra_cf: Fix some return values in 'electra_cf_probe()' in case of error Christophe JAILLET
  2020-06-17 20:10 ` Olof Johansson
@ 2020-12-05  8:31 ` Dominik Brodowski
  1 sibling, 0 replies; 4+ messages in thread
From: Dominik Brodowski @ 2020-12-05  8:31 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: akpm, peterz, olof, hch, linux-kernel, kernel-janitors

Am Wed, Jun 17, 2020 at 09:53:26PM +0200 schrieb Christophe JAILLET:
> 'status' is known to be 0 at this point. It must be set to a meaningful
> value in order to return an error code if one of the 'of_get_property()'
> call fails.
> 
> Return -EINVAL in such a case.
> 
> Fixes: 2b571a066a2f("pcmcia: CompactFlash driver for PA Semi Electra boards")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied to pcmcia-next. Thanks!

	Dominik

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-05  8:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 19:53 [PATCH] pcmcia/electra_cf: Fix some return values in 'electra_cf_probe()' in case of error Christophe JAILLET
2020-06-17 20:10 ` Olof Johansson
2020-06-17 20:27   ` Christophe JAILLET
2020-12-05  8:31 ` Dominik Brodowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).