Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: r852: disable the engine when card registration fails
@ 2026-11-09  0:20 James Hilliard
  2026-12-04 21:13 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: James Hilliard @ 2026-11-09  0:20 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Maxim Levitsky
  Cc: linux-mtd, linux-kernel, stable, James Hilliard

r852_register_nand_device() enables the NAND engine before scanning and
registering the card. If sm_register_device() or device_create_file()
fails, the error path leaves the engine enabled while card_registered
remains clear.

A subsequent removal work item sees no registered card and skips
unregistration. The device removal path also returns immediately from
r852_unregister_nand_device() in this state, so neither path disables
the engine.

Disable the engine in the common registration-failure path after any
required NAND cleanup.

Fixes: 67e054e91924 ("mtd: nand: Add driver for Ricoh xD/SmartMedia reader")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/sashiko-outbox-204169@kernel.org/
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 drivers/mtd/nand/raw/r852.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/nand/raw/r852.c b/drivers/mtd/nand/raw/r852.c
index 92c47d351c27..073f96f73be3 100644
--- a/drivers/mtd/nand/raw/r852.c
+++ b/drivers/mtd/nand/raw/r852.c
@@ -656,6 +656,7 @@ static int r852_register_nand_device(struct r852_device *dev)
 	WARN_ON(mtd_device_unregister(nand_to_mtd(dev->chip)));
 	nand_cleanup(dev->chip);
 error1:
+	r852_engine_disable(dev);
 	/* Force card redetect */
 	dev->card_detected = 0;
 	return -1;

---
base-commit: 30daaf3e7897b4a8d9b72e5b0c86dd6e2a4d7d85
change-id: 20261108-submit-r852-registration-unwind-v1-5c7cef4b5a70

Best regards,
--  
James Hilliard <james.hilliard1@gmail.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: rawnand: r852: disable the engine when card registration fails
  2026-11-09  0:20 [PATCH] mtd: rawnand: r852: disable the engine when card registration fails James Hilliard
@ 2026-12-04 21:13 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2026-12-04 21:13 UTC (permalink / raw)
  To: James Hilliard
  Cc: Richard Weinberger, Vignesh Raghavendra, Maxim Levitsky,
	linux-mtd, linux-kernel, stable

On 08/11/2026 at 17:20:55 -07, James Hilliard <james.hilliard1@gmail.com> wrote:

> r852_register_nand_device() enables the NAND engine before scanning and
> registering the card. If sm_register_device() or device_create_file()
> fails, the error path leaves the engine enabled while card_registered
> remains clear.
>
> A subsequent removal work item sees no registered card and skips
> unregistration. The device removal path also returns immediately from
> r852_unregister_nand_device() in this state, so neither path disables
> the engine.
>
> Disable the engine in the common registration-failure path after any
> required NAND cleanup.
>
> Fixes: 67e054e91924 ("mtd: nand: Add driver for Ricoh xD/SmartMedia reader")
> Cc: stable@vger.kernel.org
> Link: https://lore.kernel.org/r/sashiko-outbox-204169@kernel.org/
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>

Seems like there is a conflict with the other patches. Please rebase on
top of nand/next.

Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04 21:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09  0:20 [PATCH] mtd: rawnand: r852: disable the engine when card registration fails James Hilliard
2026-12-04 21:13 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox