[PATCH v3] mtd: spi-nor: use guard() in spi_nor_rww_start_exclusive

Miquel Raynal miquel.raynal at bootlin.com
Tue Aug 11 01:41:15 PDT 2026


On 11/08/2026 at 16:31:11 +08, Runyu Xiao <runyu.xiao at seu.edu.cn> wrote:

> Commit 03e7bb864d9a ("mtd: spi-nor: use scope-based mutex cleanup
> helpers") converted the RWW start helpers to scoped mutex cleanup, but
> left spi_nor_rww_start_exclusive() using a plain mutex_lock().
>
> spi_nor_rww_start_exclusive() is used as a wait_event_killable()
> condition. When it returns false on the busy path, the raw mutex_lock()
> leaves nor->lock held and blocks the operation that must clear the RWW
> state in spi_nor_rww_end_exclusive().
>
> Use guard(mutex) here as well so this helper matches the other RWW
> start helpers and releases nor->lock on the false return path.
>
> Fixes: 03e7bb864d9a ("mtd: spi-nor: use scope-based mutex cleanup helpers")
> Cc: stable at vger.kernel.org
> Signed-off-by: Runyu Xiao <runyu.xiao at seu.edu.cn>

Reviewed-by: Miquel Raynal <miquel.raynal at bootlin.com>



More information about the linux-mtd mailing list