stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Cc: "linux-mtd @ lists . infradead . org"
	<linux-mtd@lists.infradead.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 1/4] mtd: cfi_cmdset_0002: Use right chip in do_ppb_xxlock()
Date: Wed, 20 Jun 2018 11:03:15 +0200	[thread overview]
Message-ID: <20180620110315.2af69cfe@bbrezillon> (raw)
In-Reply-To: <20180606101330.11071-1-joakim.tjernlund@infinera.com>

On Wed,  6 Jun 2018 12:13:27 +0200
Joakim Tjernlund <joakim.tjernlund@infinera.com> wrote:

> do_ppb_xxlock() fails to add chip->start when
> quering for lock status(and chip_ready test),

  ^ querying?

> which caused false status reports.

The 3 above lines are wrapped at less than 50 chars, is this normal?

> Fix by adding adr += chip->start and adjust call sites accordingly.
> 
> Fixes: 1648eaaa1575 ("mtd: cfi_cmdset_0002: Support Persistent Protection Bits (PPB) locking")
> Cc: stable@vger.kernel.org
> Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
> ---
> 
>  v2 - Spilt into several patches
>  
>  drivers/mtd/chips/cfi_cmdset_0002.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
> index 53a976a8e614..8648b1adccd5 100644
> --- a/drivers/mtd/chips/cfi_cmdset_0002.c
> +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
> @@ -2554,8 +2554,9 @@ static int __maybe_unused do_ppb_xxlock(struct map_info *map,
>  	unsigned long timeo;
>  	int ret;
>  
> +	adr += chip->start;
>  	mutex_lock(&chip->mutex);
> -	ret = get_chip(map, chip, adr + chip->start, FL_LOCKING);
> +	ret = get_chip(map, chip, adr, FL_LOCKING);
>  	if (ret) {
>  		mutex_unlock(&chip->mutex);
>  		return ret;
> @@ -2573,8 +2574,8 @@ static int __maybe_unused do_ppb_xxlock(struct map_info *map,
>  
>  	if (thunk == DO_XXLOCK_ONEBLOCK_LOCK) {
>  		chip->state = FL_LOCKING;
> -		map_write(map, CMD(0xA0), chip->start + adr);
> -		map_write(map, CMD(0x00), chip->start + adr);
> +		map_write(map, CMD(0xA0), adr);
> +		map_write(map, CMD(0x00), adr);
>  	} else if (thunk == DO_XXLOCK_ONEBLOCK_UNLOCK) {
>  		/*
>  		 * Unlocking of one specific sector is not supported, so we
> @@ -2612,7 +2613,7 @@ static int __maybe_unused do_ppb_xxlock(struct map_info *map,
>  	map_write(map, CMD(0x00), chip->start);
>  
>  	chip->state = FL_READY;
> -	put_chip(map, chip, adr + chip->start);
> +	put_chip(map, chip, adr);
>  	mutex_unlock(&chip->mutex);
>  
>  	return ret;

  parent reply	other threads:[~2018-06-20  9:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180605172607.50acb34f@bbrezillon>
2018-06-06 10:13 ` [PATCH v2 1/4] mtd: cfi_cmdset_0002: Use right chip in do_ppb_xxlock() Joakim Tjernlund
2018-06-06 10:13   ` [PATCH v2 2/4] mtd: cfi_cmdset_0002: fix SEGV unlocking multiple chips Joakim Tjernlund
2018-06-20  9:06     ` Boris Brezillon
2018-06-06 10:13   ` [PATCH v2 3/4] mtd: cfi_cmdset_0002: Avoid point less unlocking/locking Joakim Tjernlund
2018-06-20  9:14     ` Boris Brezillon
2018-06-20 11:10       ` Joakim Tjernlund
2018-06-20 11:54         ` Boris Brezillon
2018-06-06 10:13   ` [PATCH v2 4/4] mtd: cfi_cmdset_0002: Avoid walking all chips when unlocking Joakim Tjernlund
2018-06-20  9:25     ` Boris Brezillon
2018-06-20 11:10       ` Joakim Tjernlund
2018-06-20 12:19         ` Boris Brezillon
2018-06-20 15:07           ` Joakim Tjernlund
2018-06-20  9:03   ` Boris Brezillon [this message]
2018-06-20 11:10     ` [PATCH v2 1/4] mtd: cfi_cmdset_0002: Use right chip in do_ppb_xxlock() Joakim Tjernlund
2018-06-22 11:35   ` Boris Brezillon

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=20180620110315.2af69cfe@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=joakim.tjernlund@infinera.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=stable@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).