Skip to contentSkip to conversation

irqchip: mtk-sysirq: fix an error code

PATCH In review Dan Carpenter 2 participants 2 messages Jan 30, 2015 – Feb 4, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irqchip: mtk-sysirq: fix an error code

"chip_data->intpol_base" used to be an ERR_PTR() but we recently changed it to be NULL. We need to update the error code as well because "PTR_ERR(NULL)" means success where really we want to return -ENOMEM.

Fixes cdb647a772e9 ('irqchip: mtk-sysirq: Get irq number from register resource size')
drivers/irqchip/irq-mtk-sysirq.c +1 -1
index eaf0a71..22eb34c 100644
@@ -144,7 +144,7 @@ static int __init mtk_sysirq_of_init(struct device_node *node,
 	chip_data->intpol_base = ioremap(res.start, size);
 	if (!chip_data->intpol_base) {
 		pr_err("mtk_sysirq: unable to map sysirq register\n");
-		ret = PTR_ERR(chip_data->intpol_base);
+		ret = -ENOMEM;
 		goto out_free;
 	}
 
Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines · Dan Carpenter

"chip_data->intpol_base" used to be an ERR_PTR() but we recently changed it to be NULL. We need to update the error code as well because "PTR_ERR(NULL)" means success where really we want to return -ENOMEM.

Fixes cdb647a772e9 ('irqchip: mtk-sysirq: Get irq number from register resource size')
drivers/irqchip/irq-mtk-sysirq.c +0 -0
index eaf0a71..22eb34c 100644

drivers/irqchip/irq-mtk-sysirq.c static int __init mtk_sysirq_of_init(struct device_node *node, · line 150

Quoted 8 lines
drivers/irqchip/irq-mtk-sysirq.c +1 -1
@@ -144,7 +144,7 @@ static int __init mtk_sysirq_of_init(struct device_node *node,
 	chip_data->intpol_base = ioremap(res.start, size);
 	if (!chip_data->intpol_base) {
 		pr_err("mtk_sysirq: unable to map sysirq register\n");
-		ret = PTR_ERR(chip_data->intpol_base);
+		ret = -ENOMEM;
 		goto out_free;
 	}
 

Dan,

Thanks for catching this.

I changed to use ioremap(), and remember to change the null pointer check but not the return type. Sorry for the mistake.

Joe.C