All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olof Johansson <olof@lixom.net>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Christoph Hellwig <hch@lst.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] pcmcia/electra_cf: Fix some return values in 'electra_cf_probe()' in case of error
Date: Wed, 17 Jun 2020 13:10:25 -0700	[thread overview]
Message-ID: <CAOesGMjC_KttO0T89UbWpnsWsGqWeSnpqJr9JTEn2OtQ=xWtoQ@mail.gmail.com> (raw)
In-Reply-To: <20200617195326.732863-1-christophe.jaillet@wanadoo.fr>

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

WARNING: multiple messages have this Message-ID (diff)
From: Olof Johansson <olof@lixom.net>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Christoph Hellwig <hch@lst.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] pcmcia/electra_cf: Fix some return values in 'electra_cf_probe()' in case of error
Date: Wed, 17 Jun 2020 20:10:25 +0000	[thread overview]
Message-ID: <CAOesGMjC_KttO0T89UbWpnsWsGqWeSnpqJr9JTEn2OtQ=xWtoQ@mail.gmail.com> (raw)
In-Reply-To: <20200617195326.732863-1-christophe.jaillet@wanadoo.fr>

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

  reply	other threads:[~2020-06-17 20:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 19:53 ` Christophe JAILLET
2020-06-17 20:10 ` Olof Johansson [this message]
2020-06-17 20:10   ` Olof Johansson
2020-06-17 20:27   ` Christophe JAILLET
2020-06-17 20:27     ` Christophe JAILLET
2020-12-05  8:31 ` Dominik Brodowski
2020-12-05  8:31   ` Dominik Brodowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOesGMjC_KttO0T89UbWpnsWsGqWeSnpqJr9JTEn2OtQ=xWtoQ@mail.gmail.com' \
    --to=olof@lixom.net \
    --cc=akpm@linux-foundation.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=hch@lst.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.