Commit c73e4426 authored by Vincent's avatar Vincent Committed by David S. Miller

net: thunderx: avoid dereferencing xcv when NULL

This fixes the following smatch and coccinelle warnings:

  drivers/net/ethernet/cavium/thunder/thunder_xcv.c:119 xcv_setup_link() error: we previously assumed 'xcv' could be null (see line 118) [smatch]
  drivers/net/ethernet/cavium/thunder/thunder_xcv.c:119:16-20: ERROR: xcv is NULL but dereferenced. [coccinelle]

Fixes: 6465859a ("net: thunderx: Add RGMII interface type support")
Signed-off-by: default avatarVincent Stehlé <vincent.stehle@laposte.net>
Cc: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 040587af
...@@ -116,8 +116,7 @@ void xcv_setup_link(bool link_up, int link_speed) ...@@ -116,8 +116,7 @@ void xcv_setup_link(bool link_up, int link_speed)
int speed = 2; int speed = 2;
if (!xcv) { if (!xcv) {
dev_err(&xcv->pdev->dev, pr_err("XCV init not done, probe may have failed\n");
"XCV init not done, probe may have failed\n");
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment