In case of error, the function ioremap() returns NULL pointer not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.
Fixes: 9b54470afd83 ("irqchip: add initial support for ompic")
Signed-off-by: Wei Yongjun <[email protected]>
---
drivers/irqchip/irq-ompic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-ompic.c b/drivers/irqchip/irq-ompic.c
index cf6d0c4..400b119 100644
--- a/drivers/irqchip/irq-ompic.c
+++ b/drivers/irqchip/irq-ompic.c
@@ -171,9 +171,9 @@ static int __init ompic_of_init(struct device_node *node,
/* Setup the device */
ompic_base = ioremap(res.start, resource_size(&res));
- if (IS_ERR(ompic_base)) {
+ if (!ompic_base) {
pr_err("ompic: unable to map registers");
- return PTR_ERR(ompic_base);
+ return -ENOMEM;
}
irq = irq_of_parse_and_map(node, 0);
On Tue, Jan 02, 2018 at 11:47:19AM +0000, Wei Yongjun wrote:
> In case of error, the function ioremap() returns NULL pointer not
> ERR_PTR(). The IS_ERR() test in the return value check should be
> replaced with NULL test.
Thanks, I am not sure why I was using the *ERR*() macros. 2 questions:
- How did you notice this?
- Should I pull this in through my tree or do you have another route? i.e.
Marc?
> Fixes: 9b54470afd83 ("irqchip: add initial support for ompic")
> Signed-off-by: Wei Yongjun <[email protected]>
Acked-by: Stafford Horne <[email protected]>
-Stafford
> ---
> drivers/irqchip/irq-ompic.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/irqchip/irq-ompic.c b/drivers/irqchip/irq-ompic.c
> index cf6d0c4..400b119 100644
> --- a/drivers/irqchip/irq-ompic.c
> +++ b/drivers/irqchip/irq-ompic.c
> @@ -171,9 +171,9 @@ static int __init ompic_of_init(struct device_node *node,
>
> /* Setup the device */
> ompic_base = ioremap(res.start, resource_size(&res));
> - if (IS_ERR(ompic_base)) {
> + if (!ompic_base) {
> pr_err("ompic: unable to map registers");
> - return PTR_ERR(ompic_base);
> + return -ENOMEM;
> }
>
> irq = irq_of_parse_and_map(node, 0);
>
On Wed, Jan 03, 2018 10:41 PM, Stafford Horne wrote:
> On Tue, Jan 02, 2018 at 11:47:19AM +0000, Wei Yongjun wrote:
> > In case of error, the function ioremap() returns NULL pointer not
> > ERR_PTR(). The IS_ERR() test in the return value check should be
> > replaced with NULL test.
>
> Thanks, I am not sure why I was using the *ERR*() macros. 2 questions:
>
> - How did you notice this?
This is detected by Coccinelle semantic patch.
> - Should I pull this in through my tree or do you have another route? i.e.
> Marc?
Feel free to pull this through your tree.
On 04/01/18 03:56, weiyongjun (A) wrote:
> On Wed, Jan 03, 2018 10:41 PM, Stafford Horne wrote:
>> On Tue, Jan 02, 2018 at 11:47:19AM +0000, Wei Yongjun wrote:
>>> In case of error, the function ioremap() returns NULL pointer not
>>> ERR_PTR(). The IS_ERR() test in the return value check should be
>>> replaced with NULL test.
>>
>> Thanks, I am not sure why I was using the *ERR*() macros. 2 questions:
>>
>> - How did you notice this?
>
> This is detected by Coccinelle semantic patch.
>
>> - Should I pull this in through my tree or do you have another route? i.e.
>> Marc?
>
> Feel free to pull this through your tree.
That's for me to say... I'll take it.
Thanks,
M.
--
Jazz is not dead. It just smells funny...