All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "James Hilliard" <james.hilliard1@gmail.com>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Maxim Levitsky" <maximlevitsky@gmail.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] mtd: rawnand: r852: disable the engine when card registration fails
Date: Mon, 09 Nov 2026 00:24:46 +0000	[thread overview]
Message-ID: <sashiko-outbox-204208@kernel.org> (raw)
In-Reply-To: <20261108-submit-r852-registration-unwind-v1-v1-1-e54be2c652c2@gmail.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] mtd: rawnand: r852: ignored sm_controller_ops in
  sm_register_device() [1]
--

commit b0db256c0e7e95a57788ef377b493f1dae9d2218
Author: James Hilliard <james.hilliard1@gmail.com>

mtd: rawnand: r852: disable the engine when card registration fails

This commit calls r852_engine_disable() in the error path of
r852_register_nand_device() when sm_register_device() or
device_create_file() fails.

Link: https://lore.kernel.org/r/sashiko-outbox-204169@kernel.org/

> diff --git a/drivers/mtd/nand/raw/r852.c b/drivers/mtd/nand/raw/r852.c
> index 92c47d351c278..073f96f73be36 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;

[Severity: High]
This problem wasn't introduced by this patch, but does sm_register_device()
called earlier in r852_register_nand_device() have its sm_controller_ops
ignored [1]?

r852_probe() initializes chip->controller to &dev->controller (with
r852_ops), while sm_register_device() sets sm_controller_ops on
chip->legacy.dummy_controller:

drivers/mtd/nand/raw/sm_common.c:sm_register_device() {
    ...
	chip->legacy.dummy_controller.ops = &sm_controller_ops;
	flash_ids = smartmedia ? nand_smartmedia_flash_ids : nand_xd_flash_ids;
	ret = nand_scan_with_ids(chip, 1, flash_ids);
    ...
}

Because chip->controller is already non-NULL, nand_set_defaults() ignores
dummy_controller, so nand_attach() calls r852_attach_chip() without calling
sm_attach_chip(), leaving the card's OOB layout, bad-block marker
parameters, and page-size validation unconfigured.

[1] https://sashiko.dev/#/bug/linux-4d4f9cfa-07ac-4319-9927-3acf4cf70ca3

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261108-submit-r852-registration-unwind-v1-v1-1-e54be2c652c2@gmail.com?part=1

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

      reply	other threads:[~2026-11-09  0:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09  0:20 [PATCH] mtd: rawnand: r852: disable the engine when card registration fails James Hilliard
2026-11-09  0:20 ` James Hilliard
2026-11-09  0:24 ` sashiko-bot [this message]

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=sashiko-outbox-204208@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=james.hilliard1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=maximlevitsky@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vigneshr@ti.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.