[PATCH v2] mtd: rawnand: pasemi: Don't use static data to track per-device state
Miquel Raynal
miquel.raynal at bootlin.com
Sat Jan 7 07:38:37 PST 2023
On Mon, 2023-01-02 at 12:40:51 UTC, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= wrote:
> Up to now the pasemi nand driver only supported a single device
> instance. However the check for that was racy because two parallel calls
> of pasemi_nand_probe() could pass the check
>
> if (pasemi_nand_mtd)
> return -ENODEV;
>
> before any of them assigns a non-NULL value to it.
>
> So rework the driver to make use of per-device driver data.
>
> As an intended side effect the driver can bind more than one device and
> also gets rid of the check
>
> if (!pasemi_nand_mtd)
> return 0;
>
> in the remove callback that could only ever trigger after the above race
> happened.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
More information about the linux-mtd
mailing list