[PATCH] gwdpa: gswip: fix odd_ptr_err.cocci warnings

From: Julia Lawall
Date: Thu Feb 20 2020 - 09:43:44 EST


From: kbuild test robot <lkp@xxxxxxxxx>

PTR_ERR should typically access the value just tested by IS_ERR

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

Fixes: 69fab0a67a95 ("gwdpa: gswip: Introduce Gigabit Ethernet Switch (GSWIP) device driver")
CC: Jack Ping CHNG <jack.ping.chng@xxxxxxxxxxxxxxx>
Signed-off-by: kbuild test robot <lkp@xxxxxxxxx>
Signed-off-by: Julia Lawall <julia.lawall@xxxxxxxx>

---

Maybe the code is correct, but just unnecessarily obscure.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue
head: 7a6fc7fc71cf6316739b60fcffdb86e0c43f99b5
commit: 69fab0a67a95208a25af95de20a0301298ee23f6 [43/47] gwdpa: gswip: Introduce Gigabit Ethernet Switch (GSWIP) device driver
:::::: branch date: 9 hours ago
:::::: commit date: 9 hours ago

gswip_dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/intel/gwdpa/gswip/gswip_dev.c
+++ b/drivers/net/ethernet/intel/gwdpa/gswip/gswip_dev.c
@@ -96,7 +96,7 @@ static int np_gswip_parse_dt(struct plat

pdata->sw_clk = devm_clk_get(dev, "switch");
if (IS_ERR(pdata->sw_clk))
- return PTR_ERR(priv->pdata.sw_clk);
+ return PTR_ERR(pdata->sw_clk);

for_each_node_by_name(node, GSWIP_MAC_DEV_NAME) {
priv->num_subdev_mac++;