diff mbox series

mtd: rawnand: brcmnand: propagate init error -EPROBE_DEFER up

Message ID 20230718163331.9116-1-zajec5@gmail.com
State New
Headers show
Series mtd: rawnand: brcmnand: propagate init error -EPROBE_DEFER up | expand

Commit Message

Rafał Miłecki July 18, 2023, 4:33 p.m. UTC
From: Rafał Miłecki <rafal@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@milecki.pl>
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Miquel Raynal July 19, 2023, 8:24 a.m. UTC | #1
Hi Rafał,

zajec5@gmail.com wrote on Tue, 18 Jul 2023 18:33:31 +0200:

> From: Rafał Miłecki <rafal@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@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?

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


Thanks,
Miquèl
Rafał Miłecki July 19, 2023, 8:38 a.m. UTC | #2
On 2023-07-19 10:24, Miquel Raynal wrote:
> Hi Rafał,
> 
> zajec5@gmail.com wrote on Tue, 18 Jul 2023 18:33:31 +0200:
> 
>> From: Rafał Miłecki <rafal@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@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
diff mbox series

Patch

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;
 				devm_kfree(dev, host);
 				continue; /* Try all chip-selects */
 			}