linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] irqchip: Fix some issues and do some code cleanups about Loongson
@ 2020-06-24  6:35 Tiezhu Yang
  2020-06-24  6:35 ` [PATCH v2 1/7] irqchip/loongson-htpic: Remove redundant kfree operation Tiezhu Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tiezhu Yang @ 2020-06-24  6:35 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring
  Cc: Huacai Chen, Jiaxun Yang, linux-kernel, devicetree, linux-mips,
	Xuefeng Li

Check the return value of irq_domain_translate_onecell() and
irq_domain_translate_twocell(), do some code cleanups about
Loongson to make it more clean and readable.

v2:
  - In order to avoid git send-email failed, make the related patches
    about Loongson into a new patch series and add "Fixes" tag

Tiezhu Yang (7):
  irqchip/loongson-htpic: Remove redundant kfree operation
  irqchip/loongson-htpic: Remove unneeded select of I8259
  irqchip/loongson-htvec: Fix potential resource leak
  irqchip/loongson-htvec: Check return value of
    irq_domain_translate_onecell()
  irqchip/loongson-pch-pic: Check return value of
    irq_domain_translate_twocell()
  irqchip/loongson-pch-msi: Remove unneeded variable
  dt-bindings: interrupt-controller: Fix typos in loongson,liointc.yaml

 .../bindings/interrupt-controller/loongson,liointc.yaml   |  4 ++--
 drivers/irqchip/Kconfig                                   |  1 -
 drivers/irqchip/irq-loongson-htpic.c                      |  6 ++----
 drivers/irqchip/irq-loongson-htvec.c                      | 10 ++++++++--
 drivers/irqchip/irq-loongson-pch-msi.c                    |  7 +------
 drivers/irqchip/irq-loongson-pch-pic.c                    | 15 +++++++++------
 6 files changed, 22 insertions(+), 21 deletions(-)

-- 
2.1.0


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

* [PATCH v2 1/7] irqchip/loongson-htpic: Remove redundant kfree operation
  2020-06-24  6:35 [PATCH v2 0/7] irqchip: Fix some issues and do some code cleanups about Loongson Tiezhu Yang
@ 2020-06-24  6:35 ` Tiezhu Yang
  2020-06-24  6:35 ` [PATCH v2 2/7] irqchip/loongson-htpic: Remove unneeded select of I8259 Tiezhu Yang
  2020-06-24  6:35 ` [PATCH v2 3/7] irqchip/loongson-htvec: Fix potential resource leak Tiezhu Yang
  2 siblings, 0 replies; 4+ messages in thread
From: Tiezhu Yang @ 2020-06-24  6:35 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring
  Cc: Huacai Chen, Jiaxun Yang, linux-kernel, devicetree, linux-mips,
	Xuefeng Li

In the function htpic_of_init(), when kzalloc htpic fails, it should
return -ENOMEM directly, no need to execute "goto" to kfree.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 drivers/irqchip/irq-loongson-htpic.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/irqchip/irq-loongson-htpic.c b/drivers/irqchip/irq-loongson-htpic.c
index dd018c2..63f7280 100644
--- a/drivers/irqchip/irq-loongson-htpic.c
+++ b/drivers/irqchip/irq-loongson-htpic.c
@@ -93,10 +93,8 @@ int __init htpic_of_init(struct device_node *node, struct device_node *parent)
 	}
 
 	htpic = kzalloc(sizeof(*htpic), GFP_KERNEL);
-	if (!htpic) {
-		err = -ENOMEM;
-		goto out_free;
-	}
+	if (!htpic)
+		return -ENOMEM;
 
 	htpic->base = of_iomap(node, 0);
 	if (!htpic->base) {
-- 
2.1.0


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

* [PATCH v2 2/7] irqchip/loongson-htpic: Remove unneeded select of I8259
  2020-06-24  6:35 [PATCH v2 0/7] irqchip: Fix some issues and do some code cleanups about Loongson Tiezhu Yang
  2020-06-24  6:35 ` [PATCH v2 1/7] irqchip/loongson-htpic: Remove redundant kfree operation Tiezhu Yang
@ 2020-06-24  6:35 ` Tiezhu Yang
  2020-06-24  6:35 ` [PATCH v2 3/7] irqchip/loongson-htvec: Fix potential resource leak Tiezhu Yang
  2 siblings, 0 replies; 4+ messages in thread
From: Tiezhu Yang @ 2020-06-24  6:35 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring
  Cc: Huacai Chen, Jiaxun Yang, linux-kernel, devicetree, linux-mips,
	Xuefeng Li

LOONGSON_HTPIC depends on MACH_LOONGSON64 and MACH_LOONGSON64 already
selects I8259 in arch/mips/Kconfig, so no need to select I8259 again
when config LOONGSON_HTPIC.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 drivers/irqchip/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 29fead2..9f57aed 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -541,7 +541,6 @@ config LOONGSON_HTPIC
 	default y
 	select IRQ_DOMAIN
 	select GENERIC_IRQ_CHIP
-	select I8259
 	help
 	  Support for the Loongson-3 HyperTransport PIC Controller.
 
-- 
2.1.0


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

* [PATCH v2 3/7] irqchip/loongson-htvec: Fix potential resource leak
  2020-06-24  6:35 [PATCH v2 0/7] irqchip: Fix some issues and do some code cleanups about Loongson Tiezhu Yang
  2020-06-24  6:35 ` [PATCH v2 1/7] irqchip/loongson-htpic: Remove redundant kfree operation Tiezhu Yang
  2020-06-24  6:35 ` [PATCH v2 2/7] irqchip/loongson-htpic: Remove unneeded select of I8259 Tiezhu Yang
@ 2020-06-24  6:35 ` Tiezhu Yang
  2 siblings, 0 replies; 4+ messages in thread
From: Tiezhu Yang @ 2020-06-24  6:35 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring
  Cc: Huacai Chen, Jiaxun Yang, linux-kernel, devicetree, linux-mips,
	Xuefeng Li

There exists potential resource leak in the error path, fix it.

Fixes: 818e915fbac5 ("irqchip: Add Loongson HyperTransport Vector support")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 drivers/irqchip/irq-loongson-htvec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-loongson-htvec.c b/drivers/irqchip/irq-loongson-htvec.c
index 1ece933..b36d403 100644
--- a/drivers/irqchip/irq-loongson-htvec.c
+++ b/drivers/irqchip/irq-loongson-htvec.c
@@ -192,7 +192,7 @@ static int htvec_of_init(struct device_node *node,
 	if (!priv->htvec_domain) {
 		pr_err("Failed to create IRQ domain\n");
 		err = -ENOMEM;
-		goto iounmap_base;
+		goto irq_dispose;
 	}
 
 	htvec_reset(priv);
@@ -203,6 +203,9 @@ static int htvec_of_init(struct device_node *node,
 
 	return 0;
 
+irq_dispose:
+	for (; i > 0; i--)
+		irq_dispose_mapping(parent_irq[i - 1]);
 iounmap_base:
 	iounmap(priv->base);
 free_priv:
-- 
2.1.0


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

end of thread, other threads:[~2020-06-24  6:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24  6:35 [PATCH v2 0/7] irqchip: Fix some issues and do some code cleanups about Loongson Tiezhu Yang
2020-06-24  6:35 ` [PATCH v2 1/7] irqchip/loongson-htpic: Remove redundant kfree operation Tiezhu Yang
2020-06-24  6:35 ` [PATCH v2 2/7] irqchip/loongson-htpic: Remove unneeded select of I8259 Tiezhu Yang
2020-06-24  6:35 ` [PATCH v2 3/7] irqchip/loongson-htvec: Fix potential resource leak Tiezhu 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).