MIPS: ralink: Fix request_mem_region error handling

request_mem_region returns a NULL pointer on error, comparing it
against a number results in a warning:

arch/mips/ralink/of.c: In function 'plat_of_remap_node':
arch/mips/ralink/of.c:45:15: error: ordered comparison of pointer with integer zero [-Werror=extra]
arch/mips/ralink/irq.c: In function 'intc_of_init':
arch/mips/ralink/irq.c:167:15: error: ordered comparison of pointer with integer zero [-Werror=extra]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: John Crispin <john@phrozen.org>
Cc: Tobias Wolf <dev-NTEO@vplace.de>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/15045/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
Arnd Bergmann 2017-01-17 16:18:42 +01:00 committed by Ralf Baechle
parent d92240d12a
commit 6d2700a95f
2 changed files with 4 additions and 4 deletions

View File

@ -163,8 +163,8 @@ static int __init intc_of_init(struct device_node *node,
if (of_address_to_resource(node, 0, &res)) if (of_address_to_resource(node, 0, &res))
panic("Failed to get intc memory range"); panic("Failed to get intc memory range");
if (request_mem_region(res.start, resource_size(&res), if (!request_mem_region(res.start, resource_size(&res),
res.name) < 0) res.name))
pr_err("Failed to request intc memory"); pr_err("Failed to request intc memory");
rt_intc_membase = ioremap_nocache(res.start, rt_intc_membase = ioremap_nocache(res.start,

View File

@ -40,9 +40,9 @@ __iomem void *plat_of_remap_node(const char *node)
if (of_address_to_resource(np, 0, &res)) if (of_address_to_resource(np, 0, &res))
panic("Failed to get resource for %s", node); panic("Failed to get resource for %s", node);
if ((request_mem_region(res.start, if (!request_mem_region(res.start,
resource_size(&res), resource_size(&res),
res.name) < 0)) res.name))
panic("Failed to request resources for %s", node); panic("Failed to request resources for %s", node);
return ioremap_nocache(res.start, resource_size(&res)); return ioremap_nocache(res.start, resource_size(&res));