From: navin patidar <navin.patidar@gmail.com>
To: gregkh@linuxfoundation.org
Cc: Larry.Finger@lwfinger.net, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org,
navin patidar <navin.patidar@gmail.com>
Subject: [PATCH 16/42] staging: rtl8188eu: Use kstrtoul() for string to long conversion
Date: Sun, 22 Jun 2014 13:49:36 +0530 [thread overview]
Message-ID: <1403425202-11942-17-git-send-email-navin.patidar@gmail.com> (raw)
In-Reply-To: <1403425202-11942-1-git-send-email-navin.patidar@gmail.com>
Signed-off-by: navin patidar <navin.patidar@gmail.com>
---
drivers/staging/rtl8188eu/include/osdep_service.h | 3 ---
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 24 +++++++++++++++------
drivers/staging/rtl8188eu/os_dep/osdep_service.c | 17 ---------------
3 files changed, 17 insertions(+), 27 deletions(-)
diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h b/drivers/staging/rtl8188eu/include/osdep_service.h
index 7a0afab..7c2336f 100644
--- a/drivers/staging/rtl8188eu/include/osdep_service.h
+++ b/drivers/staging/rtl8188eu/include/osdep_service.h
@@ -211,9 +211,6 @@ u32 rtw_ms_to_systime(u32 ms);
s32 rtw_get_passing_time_ms(u32 start);
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)
{
return del_timer_sync(ptimer);
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 15748a5..5cca278 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -6590,9 +6590,10 @@ static int rtw_mp_rate(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *wrqu, char *extra)
{
- u32 rate = MPT_RATE_1M;
+ unsigned long rate = MPT_RATE_1M;
char *input = kmalloc(wrqu->length, GFP_KERNEL);
struct adapter *padapter = rtw_netdev_priv(dev);
+ int status;
if (!input)
return -ENOMEM;
@@ -6600,8 +6601,12 @@ static int rtw_mp_rate(struct net_device *dev,
kfree(input);
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);
if (rate <= 0x7f)
rate = wifirate2_ratetbl_inx((u8)rate);
@@ -6623,8 +6628,9 @@ static int rtw_mp_channel(struct net_device *dev,
struct iw_point *wrqu, char *extra)
{
struct adapter *padapter = rtw_netdev_priv(dev);
- char *input = kmalloc(wrqu->length, GFP_KERNEL);
- u32 channel = 1;
+ char *input = kmalloc(wrqu->length, GFP_KERNEL);
+ unsigned long channel = 1;
+ int status;
if (!input)
return -ENOMEM;
@@ -6632,8 +6638,12 @@ static int rtw_mp_channel(struct net_device *dev,
kfree(input);
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;
Hal_SetChannel(padapter);
diff --git a/drivers/staging/rtl8188eu/os_dep/osdep_service.c b/drivers/staging/rtl8188eu/os_dep/osdep_service.c
index f43ace2..2a4469d 100644
--- a/drivers/staging/rtl8188eu/os_dep/osdep_service.c
+++ b/drivers/staging/rtl8188eu/os_dep/osdep_service.c
@@ -39,23 +39,6 @@ inline int RTW_STATUS_CODE(int error_code)
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 *pbuf = NULL;
--
1.7.10.4
prev parent reply other threads:[~2014-06-22 8:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-22 8:19 [PATCH 00/42] Remove dummy and wrapper functions navin patidar
2014-06-22 8:19 ` [PATCH 01/42] staging: rtl8188eu: Remove dummy function odm_DynamicTxPower() navin patidar
2014-06-22 8:19 ` [PATCH 02/42] staging: rtl8188eu: Remove dummy function CheckFwRsvdPageContent() navin patidar
2014-06-22 8:19 ` [PATCH 03/42] staging: rtl8188eu: Remove dummy rtl8188e_GetHalODMVar() and its wrapper navin patidar
2014-06-22 8:19 ` [PATCH 04/42] staging: rtl8188eu: Remove dummy rtl8188e_start_thread() " navin patidar
2014-06-22 8:19 ` [PATCH 05/42] staging: rtl8188eu: Remove dummy rtl8188e_stop_thread() " navin patidar
2014-06-22 8:19 ` [PATCH 06/42] staging: rtl8188eu: Remove dummy function Hal_InitChannelPlan() navin patidar
2014-06-22 8:19 ` [PATCH 07/42] staging: rtl8188eu: Remove dummy rtl8188eu_free_xmit_priv() and its wrapper navin patidar
2014-06-22 8:19 ` [PATCH 08/42] staging: rtl8188eu: Remove function _rtw_memset() navin patidar
2014-06-22 8:19 ` [PATCH 09/42] staging: rtl8188eu: Remove rtw_mfree2d(), wrapper for kfree() navin patidar
2014-06-22 8:19 ` [PATCH 10/42] staging: rtl8188eu: Remove unused function rtw_list_insert_head() navin patidar
2014-06-22 8:19 ` [PATCH 11/42] staging: rtl8188eu: Remove rtw_list_insert_tail(), wrapper for list_add_tail() navin patidar
2014-06-22 8:19 ` [PATCH 12/42] staging: rtl8188eu: Remove function rtw_end_of_queue_search() navin patidar
2014-06-22 8:19 ` [PATCH 13/42] staging: rtl8188eu: Remove rtw_is_list_empty(), wrapper for list_emty() navin patidar
2014-06-22 8:19 ` [PATCH 14/42] staging: rtl8188eu: Remove _rtw_init_listhead(), wrapper for INIT_LIST_HEAD() navin patidar
2014-06-22 8:19 ` [PATCH 15/42] staging: rtl8188eu: Remove unused function rtw_sleep_schedulable() navin patidar
2014-06-22 8:19 ` navin patidar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1403425202-11942-17-git-send-email-navin.patidar@gmail.com \
--to=navin.patidar@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®