linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: dsa: rtl8366rb: add missing of_node_put after calling of_get_child_by_name
@ 2019-09-29  7:00 Wen Yang
  2019-09-30 21:56 ` Linus Walleij
  2019-10-01 17:03 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Wen Yang @ 2019-09-29  7:00 UTC (permalink / raw)
  To: Linus Walleij
  Cc: xlpang, zhiche.yy, Wen Yang, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, netdev, linux-kernel

of_node_put needs to be called when the device node which is got
from of_get_child_by_name finished using.
irq_domain_add_linear() also calls of_node_get() to increase refcount,
so irq_domain will not be affected when it is released.

fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Vivien Didelot <vivien.didelot@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/dsa/rtl8366rb.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c
index a268085..f5cc8b0 100644
--- a/drivers/net/dsa/rtl8366rb.c
+++ b/drivers/net/dsa/rtl8366rb.c
@@ -507,7 +507,8 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
 	irq = of_irq_get(intc, 0);
 	if (irq <= 0) {
 		dev_err(smi->dev, "failed to get parent IRQ\n");
-		return irq ? irq : -EINVAL;
+		ret = irq ? irq : -EINVAL;
+		goto out_put_node;
 	}
 
 	/* This clears the IRQ status register */
@@ -515,7 +516,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
 			  &val);
 	if (ret) {
 		dev_err(smi->dev, "can't read interrupt status\n");
-		return ret;
+		goto out_put_node;
 	}
 
 	/* Fetch IRQ edge information from the descriptor */
@@ -537,7 +538,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
 				 val);
 	if (ret) {
 		dev_err(smi->dev, "could not configure IRQ polarity\n");
-		return ret;
+		goto out_put_node;
 	}
 
 	ret = devm_request_threaded_irq(smi->dev, irq, NULL,
@@ -545,7 +546,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
 					"RTL8366RB", smi);
 	if (ret) {
 		dev_err(smi->dev, "unable to request irq: %d\n", ret);
-		return ret;
+		goto out_put_node;
 	}
 	smi->irqdomain = irq_domain_add_linear(intc,
 					       RTL8366RB_NUM_INTERRUPT,
@@ -553,12 +554,15 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
 					       smi);
 	if (!smi->irqdomain) {
 		dev_err(smi->dev, "failed to create IRQ domain\n");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto out_put_node;
 	}
 	for (i = 0; i < smi->num_ports; i++)
 		irq_set_parent(irq_create_mapping(smi->irqdomain, i), irq);
 
-	return 0;
+out_put_node:
+	of_node_put(intc);
+	return ret;
 }
 
 static int rtl8366rb_set_addr(struct realtek_smi *smi)
-- 
1.8.3.1


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

* Re: [PATCH] net: dsa: rtl8366rb: add missing of_node_put after calling of_get_child_by_name
  2019-09-29  7:00 [PATCH] net: dsa: rtl8366rb: add missing of_node_put after calling of_get_child_by_name Wen Yang
@ 2019-09-30 21:56 ` Linus Walleij
  2019-10-01 17:03 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2019-09-30 21:56 UTC (permalink / raw)
  To: Wen Yang
  Cc: xlpang, zhiche.yy, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	David S. Miller, netdev, linux-kernel

On Sun, Sep 29, 2019 at 9:01 AM Wen Yang <wenyang@linux.alibaba.com> wrote:

It's nice to see some Alibaba kernel contributions!

> of_node_put needs to be called when the device node which is got
> from of_get_child_by_name finished using.
> irq_domain_add_linear() also calls of_node_get() to increase refcount,
> so irq_domain will not be affected when it is released.
>
> fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")
> Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Vivien Didelot <vivien.didelot@gmail.com>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH] net: dsa: rtl8366rb: add missing of_node_put after calling of_get_child_by_name
  2019-09-29  7:00 [PATCH] net: dsa: rtl8366rb: add missing of_node_put after calling of_get_child_by_name Wen Yang
  2019-09-30 21:56 ` Linus Walleij
@ 2019-10-01 17:03 ` David Miller
  2019-10-17  5:46   ` Wen Yang
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2019-10-01 17:03 UTC (permalink / raw)
  To: wenyang
  Cc: linus.walleij, xlpang, zhiche.yy, andrew, vivien.didelot,
	f.fainelli, netdev, linux-kernel

From: Wen Yang <wenyang@linux.alibaba.com>
Date: Sun, 29 Sep 2019 15:00:47 +0800

> of_node_put needs to be called when the device node which is got
> from of_get_child_by_name finished using.
> irq_domain_add_linear() also calls of_node_get() to increase refcount,
> so irq_domain will not be affected when it is released.
> 
> fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")
> Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>

Please capitalize Fixes:, seriously I am very curious where did you
learned to specify the fixes tag non-capitalized?

Patch applied, t hanks.

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

* Re: [PATCH] net: dsa: rtl8366rb: add missing of_node_put after calling of_get_child_by_name
  2019-10-01 17:03 ` David Miller
@ 2019-10-17  5:46   ` Wen Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Wen Yang @ 2019-10-17  5:46 UTC (permalink / raw)
  To: David Miller
  Cc: linus.walleij, xlpang, zhiche.yy, andrew, vivien.didelot,
	f.fainelli, netdev, linux-kernel


On 2019/10/2 1:03 上午, David Miller wrote:
> From: Wen Yang <wenyang@linux.alibaba.com>
> Date: Sun, 29 Sep 2019 15:00:47 +0800
> 
>> of_node_put needs to be called when the device node which is got
>> from of_get_child_by_name finished using.
>> irq_domain_add_linear() also calls of_node_get() to increase refcount,
>> so irq_domain will not be affected when it is released.
>>
>> fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")
>> Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
> 
> Please capitalize Fixes:, seriously I am very curious where did you
> learned to specify the fixes tag non-capitalized?
> 
> Patch applied, t hanks.
> 

Thank you for your comments.

We checked the code repository and found that both ‘Fixes’ and ‘fixes’
are being used, such as:

commit a53651ec93a8d7ab5b26c5390e0c389048b4b4b6
…
      net: ena: don't wake up tx queue when down
…
      fixes: 1738cd3ed342 (net: ena: Add a driver for Amazon Elastic
Network Adapters (ENA))
…

And,

commit 1df379924304b687263942452836db1d725155df
…
      clk: consoldiate the __clk_get_hw() declarations
…

      Fixes: 59fcdce425b7 ("clk: Remove ifdef for COMMON_CLK in
clk-provider.h")
      fixes: 73e0e496afda ("clkdev: Always allocate a struct clk and call
__clk_get() w/ CCF")
…


It is also found that the sha1 following ‘Fixes:’ requires at least 12
digits.

So we plan to modify the checkpatch.pl script to check for these issues.


diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a85d719..ddcd2d0 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2925,7 +2925,7 @@ sub process {
   		}

   # check for invalid commit id
-		if ($in_commit_log && $line =~
/(^fixes:|\bcommit)\s+([0-9a-f]{6,40})\b/i) {
+		if ($in_commit_log && $line =~ /(\bcommit)\s+([0-9a-f]{6,40})\b/i) {
   			my $id;
   			my $description;
   			($id, $description) = git_commit_info($2, undef, undef);
@@ -2935,6 +2935,25 @@ sub process {
   			}
   		}

+# check for fixes tag
+		if ($in_commit_log && $line =~ /(^fixes:)\s+([0-9a-f]{6,40})\b/i) {
+			my $id;
+			my $description;
+			($id, $description) = git_commit_info($2, undef, undef);
+			if (!defined($id)) {
+				WARN("UNKNOWN_COMMIT_ID",
+				     "Unknown commit id '$2', maybe rebased or not pulled?\n" .
$herecurr);
+			}
+			if ($1 ne "Fixes") {
+				WARN("FIXES_TAG_STYLE",
+				     "The fixes tag should be capitalized (Fixes:).\n" . $hereprev);
+			}
+			if (length($2) < 12) {
+				WARN("FIXES_TAG_STYLE",
+				     "SHA1 should be at least 12 digits long.\n" . $hereprev);
+			}
+		}
+
   # ignore non-hunk lines and lines being removed
   		next if (!$hunk_line || $line =~ /^-/);

--
Best wishes,
Wen Yang

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

end of thread, other threads:[~2019-10-17  5:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-29  7:00 [PATCH] net: dsa: rtl8366rb: add missing of_node_put after calling of_get_child_by_name Wen Yang
2019-09-30 21:56 ` Linus Walleij
2019-10-01 17:03 ` David Miller
2019-10-17  5:46   ` Wen Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).