All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip/irq-bcm7120-l2: add put_device() after of_find_device_by_node()
@ 2021-11-09  3:29 ` cgel.zte
  0 siblings, 0 replies; 10+ messages in thread
From: cgel.zte @ 2021-11-09  3:29 UTC (permalink / raw)
  To: f.fainelli
  Cc: tglx, maz, bcm-kernel-feedback-list, linux-mips, linux-kernel,
	linux-arm-kernel, Ye Guojin, Zeal Robot

From: Ye Guojin <ye.guojin@zte.com.cn>

This was found by coccicheck:
./drivers/irqchip/irq-bcm7120-l2.c,328,1-7,ERROR  missing put_device;
call of_find_device_by_node on line 234, but without a corresponding
object release within this function.
./drivers/irqchip/irq-bcm7120-l2.c,341,1-7,ERROR  missing put_device;
call of_find_device_by_node on line 234, but without a corresponding
object release within this function.

Addtionally, fixup the potential problem that memory is not released
before return.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
---
 drivers/irqchip/irq-bcm7120-l2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
index d80e67a6aad2..aaa70619f3c0 100644
--- a/drivers/irqchip/irq-bcm7120-l2.c
+++ b/drivers/irqchip/irq-bcm7120-l2.c
@@ -325,7 +325,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
 	pr_info("registered %s intc (%pOF, parent IRQ(s): %d)\n",
 		intc_name, dn, data->num_parent_irqs);
 
-	return 0;
+	ret = 0;
 
 out_free_domain:
 	irq_domain_remove(data->domain);
@@ -336,6 +336,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
 		if (data->map_base[idx])
 			iounmap(data->map_base[idx]);
 	}
+	put_device(&pdev->dev);
 out_free_data:
 	kfree(data);
 	return ret;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] irqchip/irq-bcm7120-l2: add put_device() after of_find_device_by_node()
@ 2021-11-09  3:29 ` cgel.zte
  0 siblings, 0 replies; 10+ messages in thread
From: cgel.zte @ 2021-11-09  3:29 UTC (permalink / raw)
  To: f.fainelli
  Cc: tglx, maz, bcm-kernel-feedback-list, linux-mips, linux-kernel,
	linux-arm-kernel, Ye Guojin, Zeal Robot

From: Ye Guojin <ye.guojin@zte.com.cn>

This was found by coccicheck:
./drivers/irqchip/irq-bcm7120-l2.c,328,1-7,ERROR  missing put_device;
call of_find_device_by_node on line 234, but without a corresponding
object release within this function.
./drivers/irqchip/irq-bcm7120-l2.c,341,1-7,ERROR  missing put_device;
call of_find_device_by_node on line 234, but without a corresponding
object release within this function.

Addtionally, fixup the potential problem that memory is not released
before return.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
---
 drivers/irqchip/irq-bcm7120-l2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
index d80e67a6aad2..aaa70619f3c0 100644
--- a/drivers/irqchip/irq-bcm7120-l2.c
+++ b/drivers/irqchip/irq-bcm7120-l2.c
@@ -325,7 +325,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
 	pr_info("registered %s intc (%pOF, parent IRQ(s): %d)\n",
 		intc_name, dn, data->num_parent_irqs);
 
-	return 0;
+	ret = 0;
 
 out_free_domain:
 	irq_domain_remove(data->domain);
@@ -336,6 +336,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
 		if (data->map_base[idx])
 			iounmap(data->map_base[idx]);
 	}
+	put_device(&pdev->dev);
 out_free_data:
 	kfree(data);
 	return ret;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] irqchip/irq-bcm7120-l2: add put_device() after of_find_device_by_node()
  2021-11-09  3:29 ` cgel.zte
@ 2021-11-09  3:40   ` Florian Fainelli
  -1 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2021-11-09  3:40 UTC (permalink / raw)
  To: cgel.zte
  Cc: tglx, maz, bcm-kernel-feedback-list, linux-mips, linux-kernel,
	linux-arm-kernel, Ye Guojin, Zeal Robot



On 11/8/2021 7:29 PM, cgel.zte@gmail.com wrote:
> From: Ye Guojin <ye.guojin@zte.com.cn>
> 
> This was found by coccicheck:
> ./drivers/irqchip/irq-bcm7120-l2.c,328,1-7,ERROR  missing put_device;
> call of_find_device_by_node on line 234, but without a corresponding
> object release within this function.
> ./drivers/irqchip/irq-bcm7120-l2.c,341,1-7,ERROR  missing put_device;
> call of_find_device_by_node on line 234, but without a corresponding
> object release within this function.
> 
> Addtionally, fixup the potential problem that memory is not released
> before return.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
> ---
>   drivers/irqchip/irq-bcm7120-l2.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
> index d80e67a6aad2..aaa70619f3c0 100644
> --- a/drivers/irqchip/irq-bcm7120-l2.c
> +++ b/drivers/irqchip/irq-bcm7120-l2.c
> @@ -325,7 +325,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
>   	pr_info("registered %s intc (%pOF, parent IRQ(s): %d)\n",
>   		intc_name, dn, data->num_parent_irqs);
>   
> -	return 0;
> +	ret = 0;

That cannot be right, we would take the irq_free_domain label and 
unregister the interrupt domain. The put_device() ought to be done when 
we stop making use of the platform_device, that is at line 246 after we 
call platform_irq_count().

Thanks!
-- 
Florian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] irqchip/irq-bcm7120-l2: add put_device() after of_find_device_by_node()
@ 2021-11-09  3:40   ` Florian Fainelli
  0 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2021-11-09  3:40 UTC (permalink / raw)
  To: cgel.zte
  Cc: tglx, maz, bcm-kernel-feedback-list, linux-mips, linux-kernel,
	linux-arm-kernel, Ye Guojin, Zeal Robot



On 11/8/2021 7:29 PM, cgel.zte@gmail.com wrote:
> From: Ye Guojin <ye.guojin@zte.com.cn>
> 
> This was found by coccicheck:
> ./drivers/irqchip/irq-bcm7120-l2.c,328,1-7,ERROR  missing put_device;
> call of_find_device_by_node on line 234, but without a corresponding
> object release within this function.
> ./drivers/irqchip/irq-bcm7120-l2.c,341,1-7,ERROR  missing put_device;
> call of_find_device_by_node on line 234, but without a corresponding
> object release within this function.
> 
> Addtionally, fixup the potential problem that memory is not released
> before return.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
> ---
>   drivers/irqchip/irq-bcm7120-l2.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
> index d80e67a6aad2..aaa70619f3c0 100644
> --- a/drivers/irqchip/irq-bcm7120-l2.c
> +++ b/drivers/irqchip/irq-bcm7120-l2.c
> @@ -325,7 +325,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
>   	pr_info("registered %s intc (%pOF, parent IRQ(s): %d)\n",
>   		intc_name, dn, data->num_parent_irqs);
>   
> -	return 0;
> +	ret = 0;

That cannot be right, we would take the irq_free_domain label and 
unregister the interrupt domain. The put_device() ought to be done when 
we stop making use of the platform_device, that is at line 246 after we 
call platform_irq_count().

Thanks!
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] irqchip/irq-bcm7120-l2: add put_device() after of_find_device_by_node()
  2021-11-09  3:40   ` Florian Fainelli
@ 2021-11-09  5:59     ` cgel.zte
  -1 siblings, 0 replies; 10+ messages in thread
From: cgel.zte @ 2021-11-09  5:59 UTC (permalink / raw)
  To: f.fainelli
  Cc: bcm-kernel-feedback-list, cgel.zte, linux-arm-kernel,
	linux-kernel, linux-mips, maz, tglx, ye.guojin, zealci

From: Ye Guojin <ye.guojin@zte.com.cn>

This was found by coccicheck:
./drivers/irqchip/irq-bcm7120-l2.c,328,1-7,ERROR  missing put_device;
call of_find_device_by_node on line 234, but without a corresponding
object release within this function.
./drivers/irqchip/irq-bcm7120-l2.c,341,1-7,ERROR  missing put_device;
call of_find_device_by_node on line 234, but without a corresponding
object release within this function.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
---
v2:
- Restore the code at line 329.
- Do put_device() when we stop making use of the platform_device, which
is at line 241.
---
 drivers/irqchip/irq-bcm7120-l2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
index d80e67a6aad2..bb6609cebdbc 100644
--- a/drivers/irqchip/irq-bcm7120-l2.c
+++ b/drivers/irqchip/irq-bcm7120-l2.c
@@ -238,6 +238,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
 	}
 
 	data->num_parent_irqs = platform_irq_count(pdev);
+	put_device(&pdev->dev);
 	if (data->num_parent_irqs <= 0) {
 		pr_err("invalid number of parent interrupts\n");
 		ret = -ENOMEM;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2] irqchip/irq-bcm7120-l2: add put_device() after of_find_device_by_node()
@ 2021-11-09  5:59     ` cgel.zte
  0 siblings, 0 replies; 10+ messages in thread
From: cgel.zte @ 2021-11-09  5:59 UTC (permalink / raw)
  To: f.fainelli
  Cc: bcm-kernel-feedback-list, cgel.zte, linux-arm-kernel,
	linux-kernel, linux-mips, maz, tglx, ye.guojin, zealci

From: Ye Guojin <ye.guojin@zte.com.cn>

This was found by coccicheck:
./drivers/irqchip/irq-bcm7120-l2.c,328,1-7,ERROR  missing put_device;
call of_find_device_by_node on line 234, but without a corresponding
object release within this function.
./drivers/irqchip/irq-bcm7120-l2.c,341,1-7,ERROR  missing put_device;
call of_find_device_by_node on line 234, but without a corresponding
object release within this function.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
---
v2:
- Restore the code at line 329.
- Do put_device() when we stop making use of the platform_device, which
is at line 241.
---
 drivers/irqchip/irq-bcm7120-l2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
index d80e67a6aad2..bb6609cebdbc 100644
--- a/drivers/irqchip/irq-bcm7120-l2.c
+++ b/drivers/irqchip/irq-bcm7120-l2.c
@@ -238,6 +238,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
 	}
 
 	data->num_parent_irqs = platform_irq_count(pdev);
+	put_device(&pdev->dev);
 	if (data->num_parent_irqs <= 0) {
 		pr_err("invalid number of parent interrupts\n");
 		ret = -ENOMEM;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] irqchip/irq-bcm7120-l2: add put_device() after of_find_device_by_node()
  2021-11-09  5:59     ` cgel.zte
@ 2021-11-09 22:37       ` Florian Fainelli
  -1 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2021-11-09 22:37 UTC (permalink / raw)
  To: cgel.zte, f.fainelli
  Cc: bcm-kernel-feedback-list, linux-arm-kernel, linux-kernel,
	linux-mips, maz, tglx, ye.guojin, zealci

On 11/8/21 9:59 PM, cgel.zte@gmail.com wrote:
> From: Ye Guojin <ye.guojin@zte.com.cn>
> 
> This was found by coccicheck:
> ./drivers/irqchip/irq-bcm7120-l2.c,328,1-7,ERROR  missing put_device;
> call of_find_device_by_node on line 234, but without a corresponding
> object release within this function.
> ./drivers/irqchip/irq-bcm7120-l2.c,341,1-7,ERROR  missing put_device;
> call of_find_device_by_node on line 234, but without a corresponding
> object release within this function.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Thank you
-- 
Florian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] irqchip/irq-bcm7120-l2: add put_device() after of_find_device_by_node()
@ 2021-11-09 22:37       ` Florian Fainelli
  0 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2021-11-09 22:37 UTC (permalink / raw)
  To: cgel.zte, f.fainelli
  Cc: bcm-kernel-feedback-list, linux-arm-kernel, linux-kernel,
	linux-mips, maz, tglx, ye.guojin, zealci

On 11/8/21 9:59 PM, cgel.zte@gmail.com wrote:
> From: Ye Guojin <ye.guojin@zte.com.cn>
> 
> This was found by coccicheck:
> ./drivers/irqchip/irq-bcm7120-l2.c,328,1-7,ERROR  missing put_device;
> call of_find_device_by_node on line 234, but without a corresponding
> object release within this function.
> ./drivers/irqchip/irq-bcm7120-l2.c,341,1-7,ERROR  missing put_device;
> call of_find_device_by_node on line 234, but without a corresponding
> object release within this function.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Thank you
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [irqchip: irq/irqchip-fixes] irqchip/irq-bcm7120-l2: add put_device() after of_find_device_by_node()
  2021-11-09  5:59     ` cgel.zte
  (?)
  (?)
@ 2021-12-10 12:28     ` irqchip-bot for Ye Guojin
  -1 siblings, 0 replies; 10+ messages in thread
From: irqchip-bot for Ye Guojin @ 2021-12-10 12:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Zeal Robot, Ye Guojin, Florian Fainelli, Marc Zyngier, tglx

The following commit has been merged into the irq/irqchip-fixes branch of irqchip:

Commit-ID:     5c19cd0a9ed9f7a067a7d9c444ff0590d1dce73f
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/5c19cd0a9ed9f7a067a7d9c444ff0590d1dce73f
Author:        Ye Guojin <ye.guojin@zte.com.cn>
AuthorDate:    Tue, 09 Nov 2021 05:59:58 
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Fri, 10 Dec 2021 12:25:00 

irqchip/irq-bcm7120-l2: add put_device() after of_find_device_by_node()

This was found by coccicheck:
./drivers/irqchip/irq-bcm7120-l2.c,328,1-7,ERROR  missing put_device;
call of_find_device_by_node on line 234, but without a corresponding
object release within this function.
./drivers/irqchip/irq-bcm7120-l2.c,341,1-7,ERROR  missing put_device;
call of_find_device_by_node on line 234, but without a corresponding
object release within this function.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211109055958.130287-1-ye.guojin@zte.com.cn
---
 drivers/irqchip/irq-bcm7120-l2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
index d80e67a..bb6609c 100644
--- a/drivers/irqchip/irq-bcm7120-l2.c
+++ b/drivers/irqchip/irq-bcm7120-l2.c
@@ -238,6 +238,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
 	}
 
 	data->num_parent_irqs = platform_irq_count(pdev);
+	put_device(&pdev->dev);
 	if (data->num_parent_irqs <= 0) {
 		pr_err("invalid number of parent interrupts\n");
 		ret = -ENOMEM;

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [irqchip: irq/irqchip-fixes] irqchip/irq-bcm7120-l2: Add put_device() after of_find_device_by_node()
  2021-11-09  5:59     ` cgel.zte
                       ` (2 preceding siblings ...)
  (?)
@ 2021-12-10 13:26     ` irqchip-bot for Ye Guojin
  -1 siblings, 0 replies; 10+ messages in thread
From: irqchip-bot for Ye Guojin @ 2021-12-10 13:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: Zeal Robot, Ye Guojin, Florian Fainelli, Marc Zyngier, tglx

The following commit has been merged into the irq/irqchip-fixes branch of irqchip:

Commit-ID:     c3fbab7767c53397d7b849799474f5a27cf306e6
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/c3fbab7767c53397d7b849799474f5a27cf306e6
Author:        Ye Guojin <ye.guojin@zte.com.cn>
AuthorDate:    Tue, 09 Nov 2021 05:59:58 
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Fri, 10 Dec 2021 13:23:13 

irqchip/irq-bcm7120-l2: Add put_device() after of_find_device_by_node()

This was found by coccicheck:
./drivers/irqchip/irq-bcm7120-l2.c,328,1-7,ERROR  missing put_device;
call of_find_device_by_node on line 234, but without a corresponding
object release within this function.
./drivers/irqchip/irq-bcm7120-l2.c,341,1-7,ERROR  missing put_device;
call of_find_device_by_node on line 234, but without a corresponding
object release within this function.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211109055958.130287-1-ye.guojin@zte.com.cn
---
 drivers/irqchip/irq-bcm7120-l2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
index d80e67a..bb6609c 100644
--- a/drivers/irqchip/irq-bcm7120-l2.c
+++ b/drivers/irqchip/irq-bcm7120-l2.c
@@ -238,6 +238,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
 	}
 
 	data->num_parent_irqs = platform_irq_count(pdev);
+	put_device(&pdev->dev);
 	if (data->num_parent_irqs <= 0) {
 		pr_err("invalid number of parent interrupts\n");
 		ret = -ENOMEM;

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-12-10 13:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09  3:29 [PATCH] irqchip/irq-bcm7120-l2: add put_device() after of_find_device_by_node() cgel.zte
2021-11-09  3:29 ` cgel.zte
2021-11-09  3:40 ` Florian Fainelli
2021-11-09  3:40   ` Florian Fainelli
2021-11-09  5:59   ` [PATCH v2] " cgel.zte
2021-11-09  5:59     ` cgel.zte
2021-11-09 22:37     ` Florian Fainelli
2021-11-09 22:37       ` Florian Fainelli
2021-12-10 12:28     ` [irqchip: irq/irqchip-fixes] " irqchip-bot for Ye Guojin
2021-12-10 13:26     ` [irqchip: irq/irqchip-fixes] irqchip/irq-bcm7120-l2: Add " irqchip-bot for Ye Guojin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.