All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Hershberger <joe.hershberger@ni.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/6] driver: net: fsl-mc: fix error handing in init_phy
Date: Wed, 25 Jul 2018 15:04:36 -0500	[thread overview]
Message-ID: <CANr=Z=ZwMSDu=FtiT1BYjKGBVjbz=7YBmQEu3KubZ9NB=ZHg6w@mail.gmail.com> (raw)
In-Reply-To: <20180713144036.17606-4-pankaj.bansal@nxp.com>

On Fri, Jul 13, 2018 at 9:40 AM, Pankaj Bansal <pankaj.bansal@nxp.com> wrote:
> if an error occurs during init_phy, we should free the phydev structure
> which has been allocated by phy_connect.
>
> Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
> ---
>  drivers/net/ldpaa_eth/ldpaa_eth.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
> index fbc724fc33..8fcb948ee8 100644
> --- a/drivers/net/ldpaa_eth/ldpaa_eth.c
> +++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
> @@ -23,6 +23,7 @@ static int init_phy(struct eth_device *dev)
>         struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)dev->priv;
>         struct phy_device *phydev = NULL;
>         struct mii_dev *bus;
> +       int ret;
>
>         bus = wriop_get_mdio(priv->dpmac_id);
>         if (bus == NULL)
> @@ -37,7 +38,15 @@ static int init_phy(struct eth_device *dev)
>
>         wriop_set_phy_dev(priv->dpmac_id, phydev);
>
> -       return phy_config(phydev);
> +       ret = phy_config(phydev);
> +
> +       if (ret) {
> +               free(phydev);
> +               phydev = NULL;

This seems odd. It's a local variable... why not just pass NULL into
wriop_set_phy_dev()? That seems clearer.

> +               wriop_set_phy_dev(priv->dpmac_id, phydev);
> +       }
> +
> +       return ret;
>  }
>  #endif
>
> --
> 2.17.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

  reply	other threads:[~2018-07-25 20:04 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13 14:40 [U-Boot] [PATCH 0/6] driver: net: fsl-mc: Add support of multiple phys for dpmac Pankaj Bansal
2018-07-13 14:40 ` [U-Boot] [PATCH 1/6] driver: net: fsl-mc: modify the label name Pankaj Bansal
2018-07-25 19:39   ` Joe Hershberger
2018-07-13 14:40 ` [U-Boot] [PATCH v3 2/6] driver: net: fsl-mc: remove unused strcture elements Pankaj Bansal
2018-07-25 20:03   ` Joe Hershberger
2018-07-13 14:40 ` [U-Boot] [PATCH 3/6] driver: net: fsl-mc: fix error handing in init_phy Pankaj Bansal
2018-07-25 20:04   ` Joe Hershberger [this message]
2018-07-13 14:40 ` [U-Boot] [PATCH 4/6] driver: net: fsl-mc: Modify the dpmac link detection method Pankaj Bansal
2018-07-25 20:13   ` Joe Hershberger
2018-07-13 14:40 ` [U-Boot] [PATCH 5/6] driver: net: fsl-mc: initialize dpmac irrespective of phy Pankaj Bansal
2018-07-25 20:14   ` Joe Hershberger
2018-07-13 14:40 ` [U-Boot] [PATCH 6/6] driver: net: fsl-mc: Add support of multiple phys for dpmac Pankaj Bansal
2018-07-25 20:52   ` Joe Hershberger
2018-07-19  3:35 ` [U-Boot] [PATCH 0/6] " Prabhakar Kushwaha
2018-07-25  3:03   ` Pankaj Bansal
2018-07-30 13:14 ` [U-Boot] [PATCH v2 " Pankaj Bansal
2018-07-30 13:15   ` [U-Boot] [PATCH v2 1/6] driver: net: fsl-mc: modify the label name Pankaj Bansal
2018-07-30 20:20     ` Joe Hershberger
2018-07-30 13:15   ` [U-Boot] [PATCH v2 2/6] driver: net: fsl-mc: remove unused strcture elements Pankaj Bansal
2018-07-30 20:19     ` Joe Hershberger
2018-07-30 13:15   ` [U-Boot] [PATCH v2 3/6] driver: net: fsl-mc: fix error handing in init_phy Pankaj Bansal
2018-07-30 20:26     ` Joe Hershberger
2018-07-30 13:15   ` [U-Boot] [PATCH v2 4/6] driver: net: fsl-mc: Modify the dpmac link detection method Pankaj Bansal
2018-07-30 20:35     ` Joe Hershberger
2018-07-30 13:15   ` [U-Boot] [PATCH v2 5/6] driver: net: fsl-mc: initialize dpmac irrespective of phy Pankaj Bansal
2018-07-30 20:36     ` Joe Hershberger
2018-07-30 13:15   ` [U-Boot] [PATCH v2 6/6] driver: net: fsl-mc: Add support of multiple phys for dpmac Pankaj Bansal
2018-07-30  8:05     ` Pankaj Bansal
2018-07-30 21:43     ` Joe Hershberger
2018-10-09 21:32     ` Joe Hershberger
2018-10-10  2:59       ` Pankaj Bansal
2018-10-10  8:27   ` [U-Boot] [PATCH v3 0/6] " Pankaj Bansal
2018-10-10  8:27     ` [U-Boot] [PATCH v3 1/6] driver: net: fsl-mc: modify the label name Pankaj Bansal
2018-10-10  8:27     ` [U-Boot] [PATCH v3 2/6] driver: net: fsl-mc: remove unused strcture elements Pankaj Bansal
2018-10-10  3:59       ` Joe Hershberger
2018-10-10  5:10         ` Pankaj Bansal
2018-10-10 18:35           ` Joe Hershberger
2018-10-10  8:28     ` [U-Boot] [PATCH v3 3/6] driver: net: fsl-mc: fix error handing in init_phy Pankaj Bansal
2018-10-10  8:28     ` [U-Boot] [PATCH v3 4/6] driver: net: fsl-mc: Modify the dpmac link detection method Pankaj Bansal
2018-10-10  8:28     ` [U-Boot] [PATCH v3 5/6] driver: net: fsl-mc: initialize dpmac irrespective of phy Pankaj Bansal
2018-10-10  8:28     ` [U-Boot] [PATCH v3 6/6] driver: net: fsl-mc: Add support of multiple phys for dpmac Pankaj Bansal
2018-10-10  8:38   ` [U-Boot] [PATCH v3 0/6] " Pankaj Bansal
2018-10-10  8:38     ` [U-Boot] [PATCH v3 1/6] driver: net: fsl-mc: modify the label name Pankaj Bansal
2018-10-22 19:28       ` [U-Boot] " Joe Hershberger
2018-10-10  8:38     ` [U-Boot] [PATCH v3 2/6] driver: net: fsl-mc: remove unused strcture elements Pankaj Bansal
2018-10-22 19:28       ` [U-Boot] " Joe Hershberger
2018-10-10  8:38     ` [U-Boot] [PATCH v3 3/6] driver: net: fsl-mc: fix error handing in init_phy Pankaj Bansal
2018-10-22 19:28       ` [U-Boot] " Joe Hershberger
2018-10-10  8:38     ` [U-Boot] [PATCH v3 4/6] driver: net: fsl-mc: Modify the dpmac link detection method Pankaj Bansal
2018-10-22 19:28       ` [U-Boot] " Joe Hershberger
2018-10-10  8:38     ` [U-Boot] [PATCH v3 5/6] driver: net: fsl-mc: initialize dpmac irrespective of phy Pankaj Bansal
2018-10-22 19:28       ` [U-Boot] " Joe Hershberger
2018-10-10  8:38     ` [U-Boot] [PATCH v3 6/6] driver: net: fsl-mc: Add support of multiple phys for dpmac Pankaj Bansal
2018-10-22 19:28       ` [U-Boot] " Joe Hershberger

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='CANr=Z=ZwMSDu=FtiT1BYjKGBVjbz=7YBmQEu3KubZ9NB=ZHg6w@mail.gmail.com' \
    --to=joe.hershberger@ni.com \
    --cc=u-boot@lists.denx.de \
    /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.