[PATCH] mtd: rawnand: brcmnand: propagate init error -EPROBE_DEFER up

Rafał Miłecki rafal at milecki.pl
Wed Jul 19 01:38:17 PDT 2023


On 2023-07-19 10:24, Miquel Raynal wrote:
> Hi Rafał,
> 
> zajec5 at gmail.com wrote on Tue, 18 Jul 2023 18:33:31 +0200:
> 
>> From: Rafał Miłecki <rafal at milecki.pl>
>> 
>> MTD subsystem may return -EPROBE_DEFER if something isn't ready yet.
>> It's important to pass that error up so device will get probed later.
>> 
>> Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
>> ---
>>  drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 ++
>>  1 file changed, 2 insertions(+)
>> 
>> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c 
>> b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
>> index 39661e23d7d4..cca2b153ae26 100644
>> --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
>> +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
>> @@ -3245,6 +3245,8 @@ int brcmnand_probe(struct platform_device *pdev, 
>> struct brcmnand_soc *soc)
>> 
>>  			ret = brcmnand_init_cs(host, NULL);
>>  			if (ret) {
>> +				if (ret == -EPROBE_DEFER)
>> +					goto err;
> 
> Don't we need an of_node_put(child) here?

Good catch!


>>  				devm_kfree(dev, host);
>>  				continue; /* Try all chip-selects */
>>  			}
> 
> 
> Thanks,
> Miquèl



More information about the linux-mtd mailing list