[PATCH 11/58] mtd: rawnand: denali: retain chips across controller removal
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Sat Nov 7 12:25:33 PST 2026
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mtd: rawnand: denali: separate __free(kfree) init in
denali_dt_chip_init()
--
commit 6e755ee59ce57be3f5cf80ff3dfee0f73764c61b
Author: James Hilliard <james.hilliard1 at gmail.com>
mtd: rawnand: denali: retain chips across controller removal
This commit switches the Denali NAND controller and chip allocations from
device-managed storage to reference-counted objects so that chips and their
controller remain live until all MTD references are dropped.
> diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
> index 8c822eae72e78..8d813cc05d049 100644
> --- a/drivers/mtd/nand/raw/denali_dt.c
> +++ b/drivers/mtd/nand/raw/denali_dt.c
[ ... ]
> @@ -81,7 +82,7 @@ MODULE_DEVICE_TABLE(of, denali_nand_dt_ids);
> static int denali_dt_chip_init(struct denali_controller *denali,
> struct device_node *chip_np)
> {
> - struct denali_chip *dchip;
> + struct denali_chip *dchip __free(kfree) = NULL;
> u32 bank;
> int nsels, i, ret;
>
> @@ -89,8 +90,7 @@ static int denali_dt_chip_init(struct denali_controller *denali,
> if (nsels < 0)
> return nsels;
>
> - dchip = devm_kzalloc(denali->dev, struct_size(dchip, sels, nsels),
> - GFP_KERNEL);
> + dchip = kzalloc(struct_size(dchip, sels, nsels), GFP_KERNEL);
[Severity: Low]
This isn't a bug, but cleanup.h convention is to define and initialize
__free() variables in a single statement at the allocation site rather than
initializing dchip to NULL at the top of denali_dt_chip_init().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261107-submit-rawnand-retained-handle-lifetime-v1-v1-0-0181ef0cc4c8@gmail.com?part=11
More information about the linux-mtd
mailing list