staging: mfd: hi6421-spmi-pmic: Fix error return in hi6421_spmi_pmic_probe()
PATCH 1/1 staging: mfd: hi6421-spmi-pmic: Fix error return in hi6421_spmi_pmic_probe()
Fix to return error code -ENOMEM from the error handling case instead of 0.
Signed-off-by Jing Xiangfeng <[email protected]>
--- drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/hikey9xx/hi6421-spmi-pmic.c +3 -1
@@ -262,8 +262,10 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)hi6421_spmi_pmic_irq_prc (pmic); pmic->irqs =devm_kzalloc (dev,HISI_IRQ_NUM *sizeof (int ),GFP_KERNEL ); -if (!pmic->irqs) +if (!pmic->irqs) { + ret = -ENOMEM ; goto irq_malloc; + } pmic->domain =irq_domain_add_simple (np,HISI_IRQ_NUM ,0 , &hi6421_spmi_domain_ops, pmic);
Signature · 1 line
2.26.0.106.g9fadedd
Quoted 13 lines · Jing Xiangfeng
Fix to return error code
-ENOMEMfrom the error handling case instead of 0.Signed-off-by Jing Xiangfeng <[email protected]>--- drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/staging/hikey9xx/hi6421-spmi-pmic.c +0
-0
drivers/staging/hikey9xx/hi6421-spmi-pmic.c static int hi6421_spmi_pmic_probe(struct spmi_device *pdev) · line 267
Quoted 7 lines
drivers/staging/hikey9xx/hi6421-spmi-pmic.c +2
-1@@ -262,8 +262,10 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)hi6421_spmi_pmic_irq_prc (pmic); pmic->irqs =devm_kzalloc (dev,HISI_IRQ_NUM *sizeof (int ),GFP_KERNEL ); -if (!pmic->irqs) +if (!pmic->irqs) { + ret = -ENOMEM ; goto irq_malloc;
It shouldn't do a goto, it should just return directly. The goto releases an IRQ which isn't acquired until later in the function.
regards,
dan carpenter