Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1233400 > unrolled thread

[PATCH 4.1 108/159] stmmac: fix check for phydev being open

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2015-09-26 23:30 +0200
Last post2015-10-01 13:10 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.1 108/159] stmmac: fix check for phydev being open Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-26 23:30 +0200
    Re: [PATCH 4.1 108/159] stmmac: fix check for phydev being open Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-09-30 13:30 +0200
      Re: [PATCH 4.1 108/159] stmmac: fix check for phydev being open Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-01 05:10 +0200
        Re: [PATCH 4.1 108/159] stmmac: fix check for phydev being open Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-10-01 13:10 +0200

#1233400 — [PATCH 4.1 108/159] stmmac: fix check for phydev being open

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2015-09-26 23:30 +0200
Subject[PATCH 4.1 108/159] stmmac: fix check for phydev being open
Message-ID<qd5cE-3vk-57@gated-at.bofh.it>
4.1-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>

commit dfc50fcaad574e5c8c85cbc83eca1426b2413fa4 upstream.

Current check of phydev with IS_ERR(phydev) may make not much sense
because of_phy_connect() returns NULL on failure instead of error value.

Still for checking result of phy_connect() IS_ERR() makes perfect sense.

So let's use combined check IS_ERR_OR_NULL() that covers both cases.

Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: linux-kernel@vger.kernel.org
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -829,8 +829,11 @@ static int stmmac_init_phy(struct net_de
 
 	phydev = phy_connect(dev, phy_id_fmt, &stmmac_adjust_link, interface);
 
-	if (IS_ERR(phydev)) {
+	if (IS_ERR_OR_NULL(phydev)) {
 		pr_err("%s: Could not attach to PHY\n", dev->name);
+		if (!phydev)
+			return -ENODEV;
+
 		return PTR_ERR(phydev);
 	}
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1236186

FromSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date2015-09-30 13:30 +0200
Message-ID<qenKb-3xS-29@gated-at.bofh.it>
In reply to#1233400
Hello.

On 9/26/2015 11:55 PM, Greg Kroah-Hartman wrote:

> 4.1-stable review patch.  If anyone has any objections, please let me know.

    NAK on the same grounds as the 3.x patches. of_phy_connect() isn't called 
yet. If the patch has been committed already, it's OK -- it should do no harm.

> ------------------
>
> From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
>
> commit dfc50fcaad574e5c8c85cbc83eca1426b2413fa4 upstream.
>
> Current check of phydev with IS_ERR(phydev) may make not much sense
> because of_phy_connect() returns NULL on failure instead of error value.
>
> Still for checking result of phy_connect() IS_ERR() makes perfect sense.
>
> So let's use combined check IS_ERR_OR_NULL() that covers both cases.
>
> Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: David Miller <davem@davemloft.net>
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> ---
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -829,8 +829,11 @@ static int stmmac_init_phy(struct net_de
>
>   	phydev = phy_connect(dev, phy_id_fmt, &stmmac_adjust_link, interface);
>
> -	if (IS_ERR(phydev)) {
> +	if (IS_ERR_OR_NULL(phydev)) {
>   		pr_err("%s: Could not attach to PHY\n", dev->name);
> +		if (!phydev)
> +			return -ENODEV;
> +
>   		return PTR_ERR(phydev);
>   	}
>

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1236921

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2015-10-01 05:10 +0200
Message-ID<qeCpQ-7Y8-9@gated-at.bofh.it>
In reply to#1236186
On Wed, Sep 30, 2015 at 02:25:43PM +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 9/26/2015 11:55 PM, Greg Kroah-Hartman wrote:
> 
> >4.1-stable review patch.  If anyone has any objections, please let me know.
> 
>    NAK on the same grounds as the 3.x patches. of_phy_connect() isn't called
> yet. If the patch has been committed already, it's OK -- it should do no
> harm.

Yeah, it's already merged, sorry.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1237276

FromSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date2015-10-01 13:10 +0200
Message-ID<qeJUm-2dw-25@gated-at.bofh.it>
In reply to#1236921
On 10/1/2015 6:04 AM, Greg Kroah-Hartman wrote:

>>> 4.1-stable review patch.  If anyone has any objections, please let me know.
>>
>>     NAK on the same grounds as the 3.x patches. of_phy_connect() isn't called
>> yet. If the patch has been committed already, it's OK -- it should do no
>> harm.

> Yeah, it's already merged, sorry.

    Sorry for not letting you know in due time.

> greg k-h

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web