All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Jisheng Zhang <jszhang@marvell.com>
Cc: Chris Ball <chris@printf.net>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH] mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles
Date: Thu, 29 Jan 2015 11:27:16 +0100	[thread overview]
Message-ID: <CAPDyKFo608ndc3FUTjYr+e9WH5fEeiO47vhuNNLs0Khfri9CDA@mail.gmail.com> (raw)
In-Reply-To: <1422446052-2323-1-git-send-email-jszhang@marvell.com>

On 28 January 2015 at 12:54, Jisheng Zhang <jszhang@marvell.com> wrote:
> Current code checks "clk_delay_cycles > 0" to know whether the optional
> "mrvl,clk_delay_cycles" is set or not. But of_property_read_u32() doesn't
> touch clk_delay_cycles if the property is not set. And type of
> clk_delay_cycles is u32, so we may always set pdata->clk_delay_cycles as a
> random value.
>
> This patch fix this problem by check the return value of of_property_read_u32()
> to know whether the optional clk-delay-cycles is set or not.
>
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> Cc: <stable@vger.kernel.org> # v3.6+

Thanks! Applied for next.

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-pxav3.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
> index c5db5d2..f1c6362 100644
> --- a/drivers/mmc/host/sdhci-pxav3.c
> +++ b/drivers/mmc/host/sdhci-pxav3.c
> @@ -268,8 +268,8 @@ static struct sdhci_pxa_platdata *pxav3_get_mmc_pdata(struct device *dev)
>         if (!pdata)
>                 return NULL;
>
> -       of_property_read_u32(np, "mrvl,clk-delay-cycles", &clk_delay_cycles);
> -       if (clk_delay_cycles > 0)
> +       if (!of_property_read_u32(np, "mrvl,clk-delay-cycles",
> +                                 &clk_delay_cycles))
>                 pdata->clk_delay_cycles = clk_delay_cycles;
>
>         return pdata;
> --
> 2.1.4
>

WARNING: multiple messages have this Message-ID (diff)
From: ulf.hansson@linaro.org (Ulf Hansson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles
Date: Thu, 29 Jan 2015 11:27:16 +0100	[thread overview]
Message-ID: <CAPDyKFo608ndc3FUTjYr+e9WH5fEeiO47vhuNNLs0Khfri9CDA@mail.gmail.com> (raw)
In-Reply-To: <1422446052-2323-1-git-send-email-jszhang@marvell.com>

On 28 January 2015 at 12:54, Jisheng Zhang <jszhang@marvell.com> wrote:
> Current code checks "clk_delay_cycles > 0" to know whether the optional
> "mrvl,clk_delay_cycles" is set or not. But of_property_read_u32() doesn't
> touch clk_delay_cycles if the property is not set. And type of
> clk_delay_cycles is u32, so we may always set pdata->clk_delay_cycles as a
> random value.
>
> This patch fix this problem by check the return value of of_property_read_u32()
> to know whether the optional clk-delay-cycles is set or not.
>
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> Cc: <stable@vger.kernel.org> # v3.6+

Thanks! Applied for next.

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-pxav3.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
> index c5db5d2..f1c6362 100644
> --- a/drivers/mmc/host/sdhci-pxav3.c
> +++ b/drivers/mmc/host/sdhci-pxav3.c
> @@ -268,8 +268,8 @@ static struct sdhci_pxa_platdata *pxav3_get_mmc_pdata(struct device *dev)
>         if (!pdata)
>                 return NULL;
>
> -       of_property_read_u32(np, "mrvl,clk-delay-cycles", &clk_delay_cycles);
> -       if (clk_delay_cycles > 0)
> +       if (!of_property_read_u32(np, "mrvl,clk-delay-cycles",
> +                                 &clk_delay_cycles))
>                 pdata->clk_delay_cycles = clk_delay_cycles;
>
>         return pdata;
> --
> 2.1.4
>

  reply	other threads:[~2015-01-29 10:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-28 11:54 [PATCH] mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles Jisheng Zhang
2015-01-28 11:54 ` Jisheng Zhang
2015-01-28 11:54 ` Jisheng Zhang
2015-01-29 10:27 ` Ulf Hansson [this message]
2015-01-29 10:27   ` Ulf Hansson
2015-01-29 10:27   ` Ulf Hansson
  -- strict thread matches above, loose matches on Subject: below --
2015-01-28  6:57 Jisheng Zhang
2015-01-28  6:57 ` Jisheng Zhang

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=CAPDyKFo608ndc3FUTjYr+e9WH5fEeiO47vhuNNLs0Khfri9CDA@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=chris@printf.net \
    --cc=jszhang@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=thomas.petazzoni@free-electrons.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 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.