staging: rtl8188eu:Remove rtw_zmalloc(), wrapper for kzalloc()
[deliverable/linux.git] / drivers / staging / rtl8188eu / os_dep / ioctl_linux.c
index 15748a543ccc1f6c1dad5b511785e7cd2da482f0..284a28ecca3b4c69e4481adffa3d37eb4cd607a8 100644 (file)
@@ -632,7 +632,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
        }
 
        if (ielen) {
-               buf = rtw_zmalloc(ielen);
+               buf = kzalloc(ielen, GFP_KERNEL);
                if (buf == NULL) {
                        ret =  -ENOMEM;
                        goto exit;
@@ -4721,13 +4721,13 @@ static u8 set_pairwise_key(struct adapter *padapter, struct sta_info *psta)
        struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
        u8 res = _SUCCESS;
 
-       ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
+       ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
        if (ph2c == NULL) {
                res = _FAIL;
                goto exit;
        }
 
-       psetstakey_para = (struct set_stakey_parm *)rtw_zmalloc(sizeof(struct set_stakey_parm));
+       psetstakey_para = kzalloc(sizeof(struct set_stakey_parm), GFP_KERNEL);
        if (psetstakey_para == NULL) {
                kfree(ph2c);
                res = _FAIL;
@@ -4759,12 +4759,12 @@ static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid)
 
        DBG_88E("%s\n", __func__);
 
-       pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct      cmd_obj));
+       pcmd = kzalloc(sizeof(struct    cmd_obj), GFP_KERNEL);
        if (pcmd == NULL) {
                res = _FAIL;
                goto exit;
        }
-       psetkeyparm = (struct setkey_parm *)rtw_zmalloc(sizeof(struct setkey_parm));
+       psetkeyparm = kzalloc(sizeof(struct setkey_parm), GFP_KERNEL);
        if (psetkeyparm == NULL) {
                kfree(pcmd);
                res = _FAIL;
@@ -5672,12 +5672,12 @@ static int rtw_mp_efuse_get(struct net_device *dev,
        pEfuseHal = &haldata->EfuseHal;
 
        err = 0;
-       data = _rtw_zmalloc(EFUSE_BT_MAX_MAP_LEN);
+       data = kzalloc(EFUSE_BT_MAX_MAP_LEN, GFP_KERNEL);
        if (data == NULL) {
                err = -ENOMEM;
                goto exit;
        }
-       rawdata = _rtw_zmalloc(EFUSE_BT_MAX_MAP_LEN);
+       rawdata = kzalloc(EFUSE_BT_MAX_MAP_LEN, GFP_KERNEL);
        if (rawdata == NULL) {
                err = -ENOMEM;
                goto exit;
@@ -5916,7 +5916,7 @@ static int rtw_mp_efuse_set(struct net_device *dev,
        haldata = GET_HAL_DATA(padapter);
        pEfuseHal = &haldata->EfuseHal;
        err = 0;
-       setdata = _rtw_zmalloc(1024);
+       setdata = kzalloc(1024, GFP_KERNEL);
        if (setdata == NULL) {
                err = -ENOMEM;
                goto exit;
@@ -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);
@@ -7428,7 +7438,7 @@ static int rtw_test(
        DBG_88E("+%s\n", __func__);
        len = wrqu->data.length;
 
-       pbuf = (u8 *)rtw_zmalloc(len);
+       pbuf = kzalloc(len, GFP_KERNEL);
        if (pbuf == NULL) {
                DBG_88E("%s: no memory!\n", __func__);
                return -ENOMEM;
@@ -7773,7 +7783,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_
        memcpy(&wdata, wrq_data, sizeof(wdata));
 
        input_len = wdata.data.length;
-       input = rtw_zmalloc(input_len);
+       input = kzalloc(input_len, GFP_KERNEL);
        if (NULL == input)
                return -ENOMEM;
        if (copy_from_user(input, wdata.data.pointer, input_len)) {
@@ -7840,7 +7850,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_
                k = j;
        }
 
-       buffer = rtw_zmalloc(4096);
+       buffer = kzalloc(4096, GFP_KERNEL);
        if (NULL == buffer) {
                err = -ENOMEM;
                goto exit;
@@ -7989,7 +7999,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_
                else
                        n = wdata.data.length;
 
-               output = rtw_zmalloc(4096);
+               output = kzalloc(4096, GFP_KERNEL);
                if (NULL == output) {
                        err =  -ENOMEM;
                        goto exit;
This page took 0.026502 seconds and 5 git commands to generate.