Skip to content

Commit c73e442

Browse files
vstehledavem330
authored andcommitted
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: 6465859 ("net: thunderx: Add RGMII interface type support") Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net> Cc: Sunil Goutham <sgoutham@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 040587a commit c73e442

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/net/ethernet/cavium/thunder/thunder_xcv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ void xcv_setup_link(bool link_up, int link_speed)
116116
int speed = 2;
117117

118118
if (!xcv) {
119-
dev_err(&xcv->pdev->dev,
120-
"XCV init not done, probe may have failed\n");
119+
pr_err("XCV init not done, probe may have failed\n");
121120
return;
122121
}
123122

0 commit comments

Comments
 (0)