Skip to contentSkip to conversation

irqchip/csky-mpintc: Fix potential resource leaks

PATCH Markus Elfring 2 participants 3 messages Jun 24, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Quoted 1 line

There exists potential resource leaks in the error path, fix them.

I suggest to improve this change description.
How do you think about another wording variant?

Specific system resources were not released in a few error cases. Thus add jump targets for the completion of the desired exception handling.

…
+++ b/drivers/irqchip/irq-csky-mpintc.c
@@ -247,8 +247,10 @@ csky_mpintc_init(struct device_node *node, struct device_node *parent) …
INTCG_base = ioremap(mfcr("cr<31, 14>"),
INTCL_SIZE*nr_cpu_ids + INTCG_SIZE);

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=3e08a95294a4fb3702bb3d35ed08028433c37fe6#n257

…
+ if (INTCG_base == NULL) {

Would you like to use the following code variant?

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/checkpatch.pl?id=3e08a95294a4fb3702bb3d35ed08028433c37fe6#n5756

+ if (!INTCG_base) {

…

Quoted 4 lines
(quoted diff) +0 -0
@@ -270,12 +274,22 @@ csky_mpintc_init(struct device_node *node, struct device_node *parent)
 
 #ifdef CONFIG_SMP
 	ipi_irq = irq_create_mapping(root_domain, IPI_IRQ);

…

Review

Quoted 4 lines
(quoted diff) +4 -0
+	if (!ipi_irq) {
+		ret = -EIO;
+		goto err_domain_remove;
+	}

…

Can the function call “irq_domain_remove(root_domain)” become relevant only if the preprocessor symbol “CONFIG_SMP” was defined?

Regards,
Markus

#1 lore raw
Quoted 6 lines · Markus Elfring
Quoted 1 line

There exists potential resource leaks in the error path, fix them.

I suggest to improve this change description.
How do you think about another wording variant?

Specific system resources were not released in a few error cases. Thus add jump targets for the completion of the desired exception handling.

OK, thank you, it looks good to me.
Maybe I can use this description for other patches of this series.

Quoted 31 lines

…
+++ b/drivers/irqchip/irq-csky-mpintc.c

(quoted diff) +0 -0
@@ -247,8 +247,10 @@ csky_mpintc_init(struct device_node *node, struct device_node *parent)
…
  		INTCG_base = ioremap(mfcr("cr<31, 14>"),
  				     INTCL_SIZE*nr_cpu_ids + INTCG_SIZE);

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id>08a95294a4fb3702bb3d35ed08028433c37fe6#n257

…

(quoted diff) +1 -0
+		if (INTCG_base = NULL) {

Would you like to use the following code variant?

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/checkpatch.pl?id>08a95294a4fb3702bb3d35ed08028433c37fe6#n5756

(quoted diff) +1 -0
+		if (!INTCG_base) {
 
 
…
Quoted 4 lines
(quoted diff) +0 -0
@@ -270,12 +274,22 @@ csky_mpintc_init(struct device_node *node, struct device_node *parent)
 
  #ifdef CONFIG_SMP
  	ipi_irq = irq_create_mapping(root_domain, IPI_IRQ);

…

Quoted 8 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+	if (!ipi_irq) {
+		ret = -EIO;
+		goto err_domain_remove;
+	}

…

Can the function call “irq_domain_remove(root_domain)” become relevant only if the preprocessor symbol “CONFIG_SMP” was defined?

OK, I will do it in the next version.

Quoted 3 lines

Regards,
Markus

#2 lore raw
Quoted 6 lines
Quoted 4 lines

How do you think about another wording variant?

    Specific system resources were not released in a few error cases. Thus add jump targets for the completion of the desired exception handling.

OK, thank you, it looks good to me.

Thanks for your positive feedback.

Quoted 1 line

Maybe I can use this description for other patches of this series.

Would you like to make any of the affected commit messages more “specific”?

Regards,
Markus