Skip to content

Commit d836cf0

Browse files
committed
phytium: phytmac: fix build with clang
Log: drivers/net/ethernet/phytium/phytmac_platform.c:232:8: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] 232 | if (!pdata->msg_regs) { | ^~~~~~~~~~~~~~~~ drivers/net/ethernet/phytium/phytmac_platform.c:311:9: note: uninitialized use occurs here 311 | return ret; | ^~~ drivers/net/ethernet/phytium/phytmac_platform.c:232:4: note: remove the 'if' if its condition is always false 232 | if (!pdata->msg_regs) { | ^~~~~~~~~~~~~~~~~~~~~~~ 233 | dev_err(&pdev->dev, "msg_regs ioremap failed, i=%d\n", i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | goto err_mem; | ~~~~~~~~~~~~~ 235 | } | ~ drivers/net/ethernet/phytium/phytmac_platform.c:172:9: note: initialize the variable 'ret' to silence this warning 172 | int ret, i; | ^ | = 0 1 error generated. Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 8bfeda6 commit d836cf0

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/net/ethernet/phytium/phytmac_platform.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ static int phytmac_plat_probe(struct platform_device *pdev)
231231
pdata->msg_regs = ioremap_wt(regs->start, MEMORY_SIZE);
232232
if (!pdata->msg_regs) {
233233
dev_err(&pdev->dev, "msg_regs ioremap failed, i=%d\n", i);
234+
ret = PTR_ERR(pdata->mac_regs);
234235
goto err_mem;
235236
}
236237
}

0 commit comments

Comments
 (0)