Skip to content

Commit f3240e2

Browse files
cavagiudavem330
authored andcommitted
stmmac: remove warning when compile as built-in (V2)
The patch removes the following serie of warnings when the driver is compiled as built-in: drivers/net/stmmac/stmmac_main.c: In function stmmac_cmdline_opt: drivers/net/stmmac/stmmac_main.c:1855:12: warning: ignoring return value of kstrtoul, declared with attribute warn_unused_result [snip] Signed-off-by: Giuseppe Cavallaro <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3bec5dc commit f3240e2

File tree

1 file changed

+42
-23
lines changed

1 file changed

+42
-23
lines changed

drivers/net/stmmac/stmmac_main.c

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,33 +1917,52 @@ static int __init stmmac_cmdline_opt(char *str)
19171917
if (!str || !*str)
19181918
return -EINVAL;
19191919
while ((opt = strsep(&str, ",")) != NULL) {
1920-
if (!strncmp(opt, "debug:", 6))
1921-
strict_strtoul(opt + 6, 0, (unsigned long *)&debug);
1922-
else if (!strncmp(opt, "phyaddr:", 8))
1923-
strict_strtoul(opt + 8, 0, (unsigned long *)&phyaddr);
1924-
else if (!strncmp(opt, "dma_txsize:", 11))
1925-
strict_strtoul(opt + 11, 0,
1926-
(unsigned long *)&dma_txsize);
1927-
else if (!strncmp(opt, "dma_rxsize:", 11))
1928-
strict_strtoul(opt + 11, 0,
1929-
(unsigned long *)&dma_rxsize);
1930-
else if (!strncmp(opt, "buf_sz:", 7))
1931-
strict_strtoul(opt + 7, 0, (unsigned long *)&buf_sz);
1932-
else if (!strncmp(opt, "tc:", 3))
1933-
strict_strtoul(opt + 3, 0, (unsigned long *)&tc);
1934-
else if (!strncmp(opt, "watchdog:", 9))
1935-
strict_strtoul(opt + 9, 0, (unsigned long *)&watchdog);
1936-
else if (!strncmp(opt, "flow_ctrl:", 10))
1937-
strict_strtoul(opt + 10, 0,
1938-
(unsigned long *)&flow_ctrl);
1939-
else if (!strncmp(opt, "pause:", 6))
1940-
strict_strtoul(opt + 6, 0, (unsigned long *)&pause);
1920+
if (!strncmp(opt, "debug:", 6)) {
1921+
if (strict_strtoul(opt + 6, 0, (unsigned long *)&debug))
1922+
goto err;
1923+
} else if (!strncmp(opt, "phyaddr:", 8)) {
1924+
if (strict_strtoul(opt + 8, 0,
1925+
(unsigned long *)&phyaddr))
1926+
goto err;
1927+
} else if (!strncmp(opt, "dma_txsize:", 11)) {
1928+
if (strict_strtoul(opt + 11, 0,
1929+
(unsigned long *)&dma_txsize))
1930+
goto err;
1931+
} else if (!strncmp(opt, "dma_rxsize:", 11)) {
1932+
if (strict_strtoul(opt + 11, 0,
1933+
(unsigned long *)&dma_rxsize))
1934+
goto err;
1935+
} else if (!strncmp(opt, "buf_sz:", 7)) {
1936+
if (strict_strtoul(opt + 7, 0,
1937+
(unsigned long *)&buf_sz))
1938+
goto err;
1939+
} else if (!strncmp(opt, "tc:", 3)) {
1940+
if (strict_strtoul(opt + 3, 0, (unsigned long *)&tc))
1941+
goto err;
1942+
} else if (!strncmp(opt, "watchdog:", 9)) {
1943+
if (strict_strtoul(opt + 9, 0,
1944+
(unsigned long *)&watchdog))
1945+
goto err;
1946+
} else if (!strncmp(opt, "flow_ctrl:", 10)) {
1947+
if (strict_strtoul(opt + 10, 0,
1948+
(unsigned long *)&flow_ctrl))
1949+
goto err;
1950+
} else if (!strncmp(opt, "pause:", 6)) {
1951+
if (strict_strtoul(opt + 6, 0, (unsigned long *)&pause))
1952+
goto err;
19411953
#ifdef CONFIG_STMMAC_TIMER
1942-
else if (!strncmp(opt, "tmrate:", 7))
1943-
strict_strtoul(opt + 7, 0, (unsigned long *)&tmrate);
1954+
} else if (!strncmp(opt, "tmrate:", 7)) {
1955+
if (strict_strtoul(opt + 7, 0,
1956+
(unsigned long *)&tmrate))
1957+
goto err;
19441958
#endif
1959+
}
19451960
}
19461961
return 0;
1962+
1963+
err:
1964+
pr_err("%s: ERROR broken module parameter conversion", __func__);
1965+
return -EINVAL;
19471966
}
19481967

19491968
__setup("stmmaceth=", stmmac_cmdline_opt);

0 commit comments

Comments
 (0)