@@ -1917,33 +1917,52 @@ static int __init stmmac_cmdline_opt(char *str)
1917
1917
if (!str || !* str )
1918
1918
return - EINVAL ;
1919
1919
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 ;
1941
1953
#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 ;
1944
1958
#endif
1959
+ }
1945
1960
}
1946
1961
return 0 ;
1962
+
1963
+ err :
1964
+ pr_err ("%s: ERROR broken module parameter conversion" , __func__ );
1965
+ return - EINVAL ;
1947
1966
}
1948
1967
1949
1968
__setup ("stmmaceth=" , stmmac_cmdline_opt );
0 commit comments