[PATCH 14/58] mtd: rawnand: intel: retain open-handle state on removal

sashiko-bot at kernel.org sashiko-bot at kernel.org
Sat Nov 7 12:31:33 PST 2026


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:
- [Medium] mtd: rawnand: intel: missing hardware disable in
  ebu_nand_probe() [1]
--

commit 42115b2b815dc0a43fa249f1ae95d7eeefbb02a5
Author: James Hilliard <james.hilliard1 at gmail.com>

mtd: rawnand: intel: retain open-handle state on removal

This commit disconnects NAND operations on removal and ties the lifetime of
the Intel EBU NAND controller and chip state to the last MTD reference.

> diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c
> index 477a427dac1f0..e4a24e69ebbcf 100644
> --- a/drivers/mtd/nand/raw/intel-nand-controller.c
> +++ b/drivers/mtd/nand/raw/intel-nand-controller.c

[ ... ]

> @@ -692,9 +699,15 @@ static int ebu_nand_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_cleanup_dma;
>  
> -	ret = mtd_device_register(mtd, NULL, 0);
> +	ret = nand_set_release(nand, NULL);
>  	if (ret)
>  		goto err_clean_nand;
> +	ret = mtd_device_register(mtd, NULL, 0);
> +	if (ret) {
> +		nand_disconnect(nand);
> +		mtd_put_master(mtd);
> +		goto err_cleanup_dma;
> +	}

[Severity: Medium]
This problem wasn't introduced by this patch, but if probe fails during or
after nand_scan() [1], doesn't jumping to err_clean_nand or
err_cleanup_dma leave EBU_CON_NANDM_EN enabled in EBU_CON?

nand_scan() runs ebu_nand_exec_op() -> ebu_select_chip(), which enables the
controller in EBU_CON, but unlike ebu_nand_remove(), the probe error paths
never call ebu_nand_disable(&ebu_host->chip) before cleaning up DMA and
returning.

[1] https://sashiko.dev/#/bug/linux-34984827-527c-4bf7-baa8-10dffee6916d

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261107-submit-rawnand-retained-handle-lifetime-v1-v1-0-0181ef0cc4c8@gmail.com?part=14



More information about the linux-mtd mailing list