mtd: nand: Use guard for mutex in nand_suspend
Subsystems (2)
PATCH 1/1 mtd: nand: Use guard for mutex in nand_suspend
Refactor nand_suspend() to use the guard(mutex) macro instead of explicit mutex_lock() and mutex_unlock() calls. This simplifies the code and improves safety by ensuring the mutex is always released via the RAII-based cleanup infrastructure when the function returns.
No functional changes intended.
Signed-off-by Richard Lyu <[email protected]>
--- drivers/mtd/nand/raw/nand_base.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/nand_base.c +1 -2
@@ -4687,12 +4687,11 @@ static int nand_suspend(struct mtd_info *mtd)struct nand_chip *chip =mtd_to_nand (mtd);int ret =0 ; -mutex_lock (&chip->lock); +guard (mutex)(&chip->lock);if (chip->ops.suspend) ret = chip->ops.suspend (chip);if (!ret) chip->suspended =1 ; -mutex_unlock (&chip->lock);return ret; }
Signature · 1 line
2.51.0