From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>, Kangjie Lu <kjlu@umn.edu>
Cc: pakki001@umn.edu, "David S. Miller" <davem@davemloft.net>,
Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Simon Horman <horms+renesas@verge.net.au>,
Chris Brandt <chris.brandt@renesas.com>,
netdev <netdev@vger.kernel.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] net: renesas: fix a missing check of of_get_phy_mode
Date: Mon, 11 Mar 2019 17:18:29 +0300 [thread overview]
Message-ID: <20b2afad-4983-3d97-2440-9745352342da@cogentembedded.com> (raw)
In-Reply-To: <CAMuHMdVfhq-d0CExnH+Y37k6pUz6OvOtScf6RbgFQ-Mx4dy4DA@mail.gmail.com>
On 03/11/2019 01:59 PM, Geert Uytterhoeven wrote:
>> of_get_phy_mode may fail and return a negative error code;
>> the fix checks the return value of of_get_phy_mode and
>> returns NULL of it fails.
>>
>> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
>
>> --- a/drivers/net/ethernet/renesas/sh_eth.c
>> +++ b/drivers/net/ethernet/renesas/sh_eth.c
>> @@ -3187,6 +3187,8 @@ static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
>> return NULL;
>>
>> pdata->phy_interface = of_get_phy_mode(np);
>> + if (pdata->phy_interface < 0)
>> + return NULL;
>
> sh_eth_plat_data.phy_interface has type phy_interface_t.
> This is an enum containing only positive values, hence it is unsigned.
> So the condition can never be true.
Good catch, thank you!
My gcc doesn't warn but doesn't generate the code for the branch either...
[...]
> Gr{oetje,eeting}s,
>
> Geert
MBR, Sergei
prev parent reply other threads:[~2019-03-11 14:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-11 7:49 Kangjie Lu
2019-03-11 10:29 ` Sergei Shtylyov
2019-03-11 17:52 ` David Miller
2019-03-11 17:55 ` Sergei Shtylyov
2019-03-12 6:30 ` [PATCH v2] net: sh_eth: " Kangjie Lu
2019-03-12 7:31 ` Sergei Shtylyov
2019-03-12 7:43 ` [PATCH v3] " Kangjie Lu
2019-03-12 7:50 ` Sergei Shtylyov
2019-03-12 8:18 ` Geert Uytterhoeven
2019-03-12 21:51 ` David Miller
2019-03-11 10:59 ` [PATCH v2] net: renesas: " Geert Uytterhoeven
2019-03-11 14:18 ` Sergei Shtylyov [this message]
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=20b2afad-4983-3d97-2440-9745352342da@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=chris.brandt@renesas.com \
--cc=davem@davemloft.net \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=horms+renesas@verge.net.au \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pakki001@umn.edu \
--cc=vladimir_zapolskiy@mentor.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®