From: Kangjie Lu <kjlu@umn.edu>
To: kjlu@umn.edu
Cc: pakki001@umn.edu,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
"David S. Miller" <davem@davemloft.net>,
Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Chris Brandt <chris.brandt@renesas.com>,
netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2] net: sh_eth: fix a missing check of of_get_phy_mode
Date: Tue, 12 Mar 2019 01:30:24 -0500 [thread overview]
Message-ID: <20190312063026.15083-1-kjlu@umn.edu> (raw)
In-Reply-To: <c205461c-edb1-c9c1-a928-8068374aef2b@cogentembedded.com>
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>
---
drivers/net/ethernet/renesas/sh_eth.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 239eeafe1b2d..e33af371b169 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -3181,14 +3181,16 @@ static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
struct device_node *np = dev->of_node;
struct sh_eth_plat_data *pdata;
const char *mac_addr;
+ int ret;
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return NULL;
- pdata->phy_interface = of_get_phy_mode(np);
- if (pdata->phy_interface < 0)
+ ret = of_get_phy_mode(np);
+ if (ret < 0)
return NULL;
+ pdata->phy_interface = ret;
mac_addr = of_get_mac_address(np);
if (mac_addr)
--
2.17.1
next prev parent reply other threads:[~2019-03-12 6:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-11 7:49 [PATCH v2] net: renesas: " 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 ` Kangjie Lu [this message]
2019-03-12 7:31 ` [PATCH v2] net: sh_eth: " 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
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=20190312063026.15083-1-kjlu@umn.edu \
--to=kjlu@umn.edu \
--cc=chris.brandt@renesas.com \
--cc=davem@davemloft.net \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pakki001@umn.edu \
--cc=sergei.shtylyov@cogentembedded.com \
--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®