Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

interconnect: imx: Fix return value check in imx_icc_node_init_qos()

In case of error, the function of_parse_phandle() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: f0d8048525d7 ("interconnect: Add imx core driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Link: https://lore.kernel.org/r/20200509030214.14435-1-weiyongjun1@huawei.com
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>

authored by

Wei Yongjun and committed by
Georgi Djakov
360a1028 4b54bf47

+4 -4
+4 -4
drivers/interconnect/imx/imx.c
··· 90 90 node->name, node->id); 91 91 } else { 92 92 dn = of_parse_phandle(dev->of_node, adj->phandle_name, 0); 93 - if (IS_ERR(dn)) { 94 - dev_warn(dev, "Failed to parse %s: %ld\n", 95 - adj->phandle_name, PTR_ERR(dn)); 96 - return PTR_ERR(dn); 93 + if (!dn) { 94 + dev_warn(dev, "Failed to parse %s\n", 95 + adj->phandle_name); 96 + return -ENODEV; 97 97 } 98 98 /* Allow scaling to be disabled on a per-node basis */ 99 99 if (!dn || !of_device_is_available(dn)) {