Commit a733e467 authored by navin patidar's avatar navin patidar Committed by Greg Kroah-Hartman

staging: rtl8188eu: Use kstrtoul() for string to long conversion

Signed-off-by: default avatarnavin patidar <navin.patidar@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fb46424e
...@@ -211,9 +211,6 @@ u32 rtw_ms_to_systime(u32 ms); ...@@ -211,9 +211,6 @@ u32 rtw_ms_to_systime(u32 ms);
s32 rtw_get_passing_time_ms(u32 start); s32 rtw_get_passing_time_ms(u32 start);
s32 rtw_get_time_interval_ms(u32 start, u32 end); s32 rtw_get_time_interval_ms(u32 start, u32 end);
u32 rtw_atoi(u8 *s);
static inline unsigned char _cancel_timer_ex(struct timer_list *ptimer) static inline unsigned char _cancel_timer_ex(struct timer_list *ptimer)
{ {
return del_timer_sync(ptimer); return del_timer_sync(ptimer);
......
...@@ -6590,9 +6590,10 @@ static int rtw_mp_rate(struct net_device *dev, ...@@ -6590,9 +6590,10 @@ static int rtw_mp_rate(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_point *wrqu, char *extra) struct iw_point *wrqu, char *extra)
{ {
u32 rate = MPT_RATE_1M; unsigned long rate = MPT_RATE_1M;
char *input = kmalloc(wrqu->length, GFP_KERNEL); char *input = kmalloc(wrqu->length, GFP_KERNEL);
struct adapter *padapter = rtw_netdev_priv(dev); struct adapter *padapter = rtw_netdev_priv(dev);
int status;
if (!input) if (!input)
return -ENOMEM; return -ENOMEM;
...@@ -6600,8 +6601,12 @@ static int rtw_mp_rate(struct net_device *dev, ...@@ -6600,8 +6601,12 @@ static int rtw_mp_rate(struct net_device *dev,
kfree(input); kfree(input);
return -EFAULT; return -EFAULT;
} }
rate = rtw_atoi(input);
sprintf(extra, "Set data rate to %d", rate); status = kstrtoul(input, 0, &rate);
if (status)
return status;
sprintf(extra, "Set data rate to %lu", rate);
kfree(input); kfree(input);
if (rate <= 0x7f) if (rate <= 0x7f)
rate = wifirate2_ratetbl_inx((u8)rate); rate = wifirate2_ratetbl_inx((u8)rate);
...@@ -6623,8 +6628,9 @@ static int rtw_mp_channel(struct net_device *dev, ...@@ -6623,8 +6628,9 @@ static int rtw_mp_channel(struct net_device *dev,
struct iw_point *wrqu, char *extra) struct iw_point *wrqu, char *extra)
{ {
struct adapter *padapter = rtw_netdev_priv(dev); struct adapter *padapter = rtw_netdev_priv(dev);
char *input = kmalloc(wrqu->length, GFP_KERNEL); char *input = kmalloc(wrqu->length, GFP_KERNEL);
u32 channel = 1; unsigned long channel = 1;
int status;
if (!input) if (!input)
return -ENOMEM; return -ENOMEM;
...@@ -6632,8 +6638,12 @@ static int rtw_mp_channel(struct net_device *dev, ...@@ -6632,8 +6638,12 @@ static int rtw_mp_channel(struct net_device *dev,
kfree(input); kfree(input);
return -EFAULT; return -EFAULT;
} }
channel = rtw_atoi(input);
sprintf(extra, "Change channel %d to channel %d", padapter->mppriv.channel, channel); status = kstrtoul(input, 0, &channel);
if (status)
return status;
sprintf(extra, "Change channel %d to channel %lu", padapter->mppriv.channel, channel);
padapter->mppriv.channel = channel; padapter->mppriv.channel = channel;
Hal_SetChannel(padapter); Hal_SetChannel(padapter);
......
...@@ -39,23 +39,6 @@ inline int RTW_STATUS_CODE(int error_code) ...@@ -39,23 +39,6 @@ inline int RTW_STATUS_CODE(int error_code)
return _FAIL; return _FAIL;
} }
u32 rtw_atoi(u8 *s)
{
int num = 0, flag = 0;
int i;
for (i = 0; i <= strlen(s); i++) {
if (s[i] >= '0' && s[i] <= '9')
num = num * 10 + s[i] - '0';
else if (s[0] == '-' && i == 0)
flag = 1;
else
break;
}
if (flag == 1)
num = num * -1;
return num;
}
u8 *_rtw_malloc(u32 sz) u8 *_rtw_malloc(u32 sz)
{ {
u8 *pbuf = NULL; u8 *pbuf = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment