[v2,2/3] mfd: mt6397: Checking for null before irq_domain_remove.
diff mbox

Message ID 1460098729-25549-2-git-send-email-henryc.chen@mediatek.com
State New
Headers show

Commit Message

Henry Chen April 8, 2016, 6:58 a.m. UTC
It is possible that pmic->irq_domain will be NULL in fail_irq error handling.
Check before calling irq_domain_remove.

Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
---
 drivers/mfd/mt6397-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Lee Jones April 11, 2016, 8:53 a.m. UTC | #1
FAO Thomas,

On Fri, 08 Apr 2016, Henry Chen wrote:
> It is possible that pmic->irq_domain will be NULL in fail_irq error handling.
> Check before calling irq_domain_remove.
> 
> Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
> ---
>  drivers/mfd/mt6397-core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
> index a879223..15050cb 100644
> --- a/drivers/mfd/mt6397-core.c
> +++ b/drivers/mfd/mt6397-core.c
> @@ -312,7 +312,8 @@ static int mt6397_probe(struct platform_device *pdev)
>  
>  fail_irq:
>  	if (ret) {
> -		irq_domain_remove(pmic->irq_domain);
> +		if (pmic->irq_domain)
> +			irq_domain_remove(pmic->irq_domain);

You might be better off making this change in the framework.

Just get irq_domain_remove() to harmlessly return if !irq_domain.

>  		dev_err(&pdev->dev, "failed to add child devices: %d\n", ret);
>  	}
>

Patch
diff mbox

diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index a879223..15050cb 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -312,7 +312,8 @@  static int mt6397_probe(struct platform_device *pdev)
 
 fail_irq:
 	if (ret) {
-		irq_domain_remove(pmic->irq_domain);
+		if (pmic->irq_domain)
+			irq_domain_remove(pmic->irq_domain);
 		dev_err(&pdev->dev, "failed to add child devices: %d\n", ret);
 	}