linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Iyappan Subramanian <isubramanian@apm.com>
To: Alban Bedel <alban.bedel@avionic-design.de>
Cc: netdev <netdev@vger.kernel.org>, Keyur Chudgar <kchudgar@apm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers: net: xgene: Fix crash on DT systems
Date: Tue, 28 Feb 2017 16:58:06 -0800	[thread overview]
Message-ID: <CAKh23FkT2nbABCxt9ic1WRR37-PkYO95naC21dNeoWtSoc1RNw@mail.gmail.com> (raw)
In-Reply-To: <20170228170855.8123-1-alban.bedel@avionic-design.de>

On Tue, Feb 28, 2017 at 9:08 AM, Alban Bedel
<alban.bedel@avionic-design.de> wrote:
> On DT systems the driver require a clock, but the probe just print a
> warning and continue, leading to a crash when resetting the device.
> To fix this crash and properly handle probe deferals only ignore the
> missing clock if DT isn't used or if the clock doesn't exist.
>
> Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
> ---
>  drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> index d0d0d12b531f..68b48edc5921 100644
> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> @@ -1756,6 +1756,12 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
>
>         pdata->clk = devm_clk_get(&pdev->dev, NULL);
>         if (IS_ERR(pdata->clk)) {
> +               /* Abort if the clock is defined but couldn't be retrived.
> +                * Always abort if the clock is missing on DT system as
> +                * the driver can't cope with this case.
> +                */
> +               if (PTR_ERR(pdata->clk) != -ENOENT || dev->of_node)
> +                       return PTR_ERR(pdata->clk);
>                 /* Firmware may have set up the clock already. */
>                 dev_info(dev, "clocks have been setup already\n");
>         }
> --
> 2.11.0
>

Thanks, Alban.

Acked-by: Iyappan Subramanian <isubramanian@apm.com>

  reply	other threads:[~2017-03-01  1:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 17:08 [PATCH] drivers: net: xgene: Fix crash on DT systems Alban Bedel
2017-03-01  0:58 ` Iyappan Subramanian [this message]
2017-03-02 20:47 ` David Miller

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=CAKh23FkT2nbABCxt9ic1WRR37-PkYO95naC21dNeoWtSoc1RNw@mail.gmail.com \
    --to=isubramanian@apm.com \
    --cc=alban.bedel@avionic-design.de \
    --cc=kchudgar@apm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).