Skip to content

Commit 34271e9

Browse files
author
WangYuli
committed
eth: phytmac: phytmac_plat_probe: initialize variable 'ret' when !pdata->msg_regs
Fix follow error with clang-19: drivers/net/ethernet/phytium/phytmac_platform.c:130:8: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] 130 | if (!pdata->msg_regs) { | ^~~~~~~~~~~~~~~~ drivers/net/ethernet/phytium/phytmac_platform.c:202:9: note: uninitialized use occurs here 202 | return ret; | ^~~ drivers/net/ethernet/phytium/phytmac_platform.c:130:4: note: remove the 'if' if its condition is always false 130 | if (!pdata->msg_regs) { | ^~~~~~~~~~~~~~~~~~~~~~~ 131 | dev_err(&pdev->dev, "msg_regs ioremap failed, i=%d\n", i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 132 | goto err_mem; | ~~~~~~~~~~~~~ 133 | } | ~ drivers/net/ethernet/phytium/phytmac_platform.c:81:9: note: initialize the variable 'ret' to silence this warning 81 | int ret, i; | ^ | = 0 1 error generated. Signed-off-by: WangYuli <wangyuli@uniontech.com>
1 parent 8ccf129 commit 34271e9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/phytium/phytmac_platform.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ static int phytmac_plat_probe(struct platform_device *pdev)
129129
pdata->msg_regs = ioremap_wt(regs->start, MEMORY_SIZE);
130130
if (!pdata->msg_regs) {
131131
dev_err(&pdev->dev, "msg_regs ioremap failed, i=%d\n", i);
132+
ret = PTR_ERR(pdata->mac_regs);
132133
goto err_mem;
133134
}
134135
}

0 commit comments

Comments
 (0)