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


Groups > linux.kernel > #1236186

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

From Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4.1 108/159] stmmac: fix check for phydev being open
Date 2015-09-30 13:30 +0200
Message-ID <qenKb-3xS-29@gated-at.bofh.it> (permalink)
References <qd4Tf-384-5@gated-at.bofh.it> <qd5cE-3vk-57@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[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

csiph-web