Skip to content

Commit

Permalink
Staging: Drop memory allocation cast
Browse files Browse the repository at this point in the history
Drop cast on the result of kmalloc and similar functions.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
@@

- (T *)
  (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
   kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...))
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Julia Lawall authored and Greg Kroah-Hartman committed May 11, 2010
1 parent a05d08c commit 3241487
Show file tree
Hide file tree
Showing 33 changed files with 52 additions and 59 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/comedi/drivers/unioxx5.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ static int __unioxx5_subdev_init(struct comedi_subdevice *subdev,
return -EIO;
}

usp = (struct unioxx5_subd_priv *)kzalloc(sizeof(*usp), GFP_KERNEL);
usp = kzalloc(sizeof(*usp), GFP_KERNEL);

if (usp == NULL) {
printk(KERN_ERR "comedi%d: erorr! --> out of memory!\n", minor);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/crystalhd/crystalhd_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ int crystalhd_create_dio_pool(struct crystalhd_adp *adp, uint32_t max_pages)
BC_LINK_SG_POOL_SZ, max_pages, asz, adp->fill_byte_pool);

for (i = 0; i < BC_LINK_SG_POOL_SZ; i++) {
temp = (uint8_t *)kzalloc(asz, GFP_KERNEL);
temp = kzalloc(asz, GFP_KERNEL);
if ((temp) == NULL) {
BCMLOG_ERR("Failed to alloc %d mem\n", asz);
return -ENOMEM;
Expand Down
6 changes: 2 additions & 4 deletions drivers/staging/cx25821/cx25821-audio-upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)

if (dev->input_audiofilename) {
str_length = strlen(dev->input_audiofilename);
dev->_audiofilename =
(char *)kmalloc(str_length + 1, GFP_KERNEL);
dev->_audiofilename = kmalloc(str_length + 1, GFP_KERNEL);

if (!dev->_audiofilename)
goto error;
Expand All @@ -766,8 +765,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
}
} else {
str_length = strlen(_defaultAudioName);
dev->_audiofilename =
(char *)kmalloc(str_length + 1, GFP_KERNEL);
dev->_audiofilename = kmalloc(str_length + 1, GFP_KERNEL);

if (!dev->_audiofilename)
goto error;
Expand Down
6 changes: 2 additions & 4 deletions drivers/staging/cx25821/cx25821-video-upstream-ch2.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,7 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select,

if (dev->input_filename_ch2) {
str_length = strlen(dev->input_filename_ch2);
dev->_filename_ch2 =
(char *)kmalloc(str_length + 1, GFP_KERNEL);
dev->_filename_ch2 = kmalloc(str_length + 1, GFP_KERNEL);

if (!dev->_filename_ch2)
goto error;
Expand All @@ -779,8 +778,7 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select,
str_length + 1);
} else {
str_length = strlen(dev->_defaultname_ch2);
dev->_filename_ch2 =
(char *)kmalloc(str_length + 1, GFP_KERNEL);
dev->_filename_ch2 = kmalloc(str_length + 1, GFP_KERNEL);

if (!dev->_filename_ch2)
goto error;
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/cx25821/cx25821-video-upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,15 +825,15 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select,

if (dev->input_filename) {
str_length = strlen(dev->input_filename);
dev->_filename = (char *)kmalloc(str_length + 1, GFP_KERNEL);
dev->_filename = kmalloc(str_length + 1, GFP_KERNEL);

if (!dev->_filename)
goto error;

memcpy(dev->_filename, dev->input_filename, str_length + 1);
} else {
str_length = strlen(dev->_defaultname);
dev->_filename = (char *)kmalloc(str_length + 1, GFP_KERNEL);
dev->_filename = kmalloc(str_length + 1, GFP_KERNEL);

if (!dev->_filename)
goto error;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/et131x/et1310_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ int et131x_init_recv(struct et131x_adapter *adapter)

/* Setup each RFD */
for (rfdct = 0; rfdct < rx_ring->NumRfd; rfdct++) {
rfd = (MP_RFD *) kmem_cache_alloc(rx_ring->RecvLookaside,
rfd = kmem_cache_alloc(rx_ring->RecvLookaside,
GFP_ATOMIC | GFP_DMA);

if (!rfd) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/et131x/et1310_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter)
struct tx_ring *tx_ring = &adapter->tx_ring;

/* Allocate memory for the TCB's (Transmit Control Block) */
adapter->tx_ring.tcb_ring = (struct tcb *)
adapter->tx_ring.tcb_ring =
kcalloc(NUM_TCB, sizeof(struct tcb), GFP_ATOMIC | GFP_DMA);
if (!adapter->tx_ring.tcb_ring) {
dev_err(&adapter->pdev->dev, "Cannot alloc memory for TCBs\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rt2860/common/cmm_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@ u32 deaggregate_AMSDU_announce(struct rt_rtmp_adapter *pAd,
if ((Header802_3[12] == 0x88) && (Header802_3[13] == 0x8E)) {
/* avoid local heap overflow, use dyanamic allocation */
struct rt_mlme_queue_elem *Elem =
(struct rt_mlme_queue_elem *)kmalloc(sizeof(struct rt_mlme_queue_elem),
kmalloc(sizeof(struct rt_mlme_queue_elem),
MEM_ALLOC_FLAG);
if (Elem != NULL) {
memmove(Elem->Msg +
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rt2860/common/cmm_mac_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ void RT28xxPciMlmeRadioOFF(struct rt_rtmp_adapter *pAd)
if (INFRA_ON(pAd) || ADHOC_ON(pAd)) {
struct rt_mlme_disassoc_req DisReq;
struct rt_mlme_queue_elem *pMsgElem =
(struct rt_mlme_queue_elem *)kmalloc(sizeof(struct rt_mlme_queue_elem),
kmalloc(sizeof(struct rt_mlme_queue_elem),
MEM_ALLOC_FLAG);

if (pMsgElem) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rt2860/common/cmm_mac_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ void RT28xxUsbMlmeRadioOFF(struct rt_rtmp_adapter *pAd)
if (INFRA_ON(pAd) || ADHOC_ON(pAd)) {
struct rt_mlme_disassoc_req DisReq;
struct rt_mlme_queue_elem *pMsgElem =
(struct rt_mlme_queue_elem *)kmalloc(sizeof(struct rt_mlme_queue_elem),
kmalloc(sizeof(struct rt_mlme_queue_elem),
MEM_ALLOC_FLAG);

if (pMsgElem) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rt2860/rt_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time)
/* pAd MUST allow to be NULL */
int os_alloc_mem(struct rt_rtmp_adapter *pAd, u8 ** mem, unsigned long size)
{
*mem = (u8 *)kmalloc(size, GFP_ATOMIC);
*mem = kmalloc(size, GFP_ATOMIC);
if (*mem)
return NDIS_STATUS_SUCCESS;
else
Expand Down
7 changes: 3 additions & 4 deletions drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)

if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
*challenge = kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
Expand Down Expand Up @@ -2861,8 +2861,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,

ieee80211_crypt_delayed_deinit(ieee, crypt);

new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL);
if (new_crypt == NULL) {
ret = -ENOMEM;
goto done;
Expand Down Expand Up @@ -2953,7 +2952,7 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin
goto out;
}

param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
param = kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
goto out;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
ieee80211_softmac_init(ieee);

#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
ieee->pHTInfo = kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
#else
ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kmalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
memset(ieee->pHTInfo,0,sizeof(RT_HIGH_THROUGHPUT));
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
/* skb: hdr + (possible reassembled) full plaintext payload */
payload = skb->data + hdrlen;
//ethertype = (payload[6] << 8) | payload[7];
rxb = (struct ieee80211_rxb*)kmalloc(sizeof(struct ieee80211_rxb),GFP_ATOMIC);
rxb = kmalloc(sizeof(struct ieee80211_rxb), GFP_ATOMIC);
if(rxb == NULL)
{
IEEE80211_DEBUG(IEEE80211_DL_ERR,"%s(): kmalloc rxb error\n",__FUNCTION__);
Expand Down
7 changes: 3 additions & 4 deletions drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1800,7 +1800,7 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)

if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
*challenge = kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
Expand Down Expand Up @@ -3459,8 +3459,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,

ieee80211_crypt_delayed_deinit(ieee, crypt);

new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL);
if (new_crypt == NULL) {
ret = -ENOMEM;
goto done;
Expand Down Expand Up @@ -3592,7 +3591,7 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin
goto out;
}

param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
param = kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
goto out;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8192e/r8192E_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -5040,7 +5040,7 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
goto out;
}

ipw = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
ipw = kmalloc(p->length, GFP_KERNEL);
if (ipw == NULL){
ret = -ENOMEM;
goto out;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8192su/ieee80211/ieee80211_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)

ieee80211_softmac_init(ieee);

ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
ieee->pHTInfo = kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
if (ieee->pHTInfo == NULL)
{
IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
/* skb: hdr + (possible reassembled) full plaintext payload */
payload = skb->data + hdrlen;
//ethertype = (payload[6] << 8) | payload[7];
rxb = (struct ieee80211_rxb*)kmalloc(sizeof(struct ieee80211_rxb),GFP_ATOMIC);
rxb = kmalloc(sizeof(struct ieee80211_rxb), GFP_ATOMIC);
if(rxb == NULL)
{
IEEE80211_DEBUG(IEEE80211_DL_ERR,"%s(): kmalloc rxb error\n",__FUNCTION__);
Expand Down
7 changes: 3 additions & 4 deletions drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)

if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
*challenge = kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
Expand Down Expand Up @@ -3048,8 +3048,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,

ieee80211_crypt_delayed_deinit(ieee, crypt);

new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL);
if (new_crypt == NULL) {
ret = -ENOMEM;
goto done;
Expand Down Expand Up @@ -3182,7 +3181,7 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin
goto out;
}

param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
param = kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
goto out;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8192su/r8192U_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -5747,7 +5747,7 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
goto out;
}

ipw = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
ipw = kmalloc(p->length, GFP_KERNEL);
if (ipw == NULL){
ret = -ENOMEM;
goto out;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)

ieee80211_softmac_init(ieee);

ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
ieee->pHTInfo = kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
if (ieee->pHTInfo == NULL)
{
IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
/* skb: hdr + (possible reassembled) full plaintext payload */
payload = skb->data + hdrlen;
//ethertype = (payload[6] << 8) | payload[7];
rxb = (struct ieee80211_rxb*)kmalloc(sizeof(struct ieee80211_rxb),GFP_ATOMIC);
rxb = kmalloc(sizeof(struct ieee80211_rxb), GFP_ATOMIC);
if(rxb == NULL)
{
IEEE80211_DEBUG(IEEE80211_DL_ERR,"%s(): kmalloc rxb error\n",__FUNCTION__);
Expand Down
7 changes: 3 additions & 4 deletions drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)

if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
*challenge = kmalloc(*chlen, GFP_ATOMIC);
if (!*challenge)
return -ENOMEM;
memcpy(*challenge, t, *chlen);
Expand Down Expand Up @@ -3077,8 +3077,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,

ieee80211_crypt_delayed_deinit(ieee, crypt);

new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL);
if (new_crypt == NULL) {
ret = -ENOMEM;
goto done;
Expand Down Expand Up @@ -3210,7 +3209,7 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin
goto out;
}

param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
param = kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
goto out;
Expand Down
10 changes: 6 additions & 4 deletions drivers/staging/rtl8192u/r8192U_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2216,7 +2216,8 @@ short rtl8192_usb_initendpoints(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);

priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * (MAX_RX_URB+1), GFP_KERNEL);
priv->rx_urb = kmalloc(sizeof(struct urb *) * (MAX_RX_URB+1),
GFP_KERNEL);

#ifndef JACKSON_NEW_RX
for(i=0;i<(MAX_RX_URB+1);i++){
Expand Down Expand Up @@ -2250,7 +2251,8 @@ short rtl8192_usb_initendpoints(struct net_device *dev)
#endif

memset(priv->rx_urb, 0, sizeof(struct urb*) * MAX_RX_URB);
priv->pp_rxskb = (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) * MAX_RX_URB, GFP_KERNEL);
priv->pp_rxskb = kmalloc(sizeof(struct sk_buff *) * MAX_RX_URB,
GFP_KERNEL);
if (priv->pp_rxskb == NULL)
goto destroy;

Expand Down Expand Up @@ -2839,7 +2841,7 @@ static void rtl8192_init_priv_variable(struct net_device* dev)
(priv->EarlyRxThreshold == 7 ? RCR_ONLYERLPKT:0);

priv->AcmControl = 0;
priv->pFirmware = (rt_firmware*)kmalloc(sizeof(rt_firmware), GFP_KERNEL);
priv->pFirmware = kmalloc(sizeof(rt_firmware), GFP_KERNEL);
if (priv->pFirmware)
memset(priv->pFirmware, 0, sizeof(rt_firmware));

Expand Down Expand Up @@ -4415,7 +4417,7 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
goto out;
}

ipw = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
ipw = kmalloc(p->length, GFP_KERNEL);
if (ipw == NULL){
ret = -ENOMEM;
goto out;
Expand Down
3 changes: 1 addition & 2 deletions drivers/staging/vme/bridges/vme_ca91cx42.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,7 @@ int ca91cx42_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src,
dev = list->parent->parent->parent;

/* XXX descriptor must be aligned on 64-bit boundaries */
entry = (struct ca91cx42_dma_entry *)
kmalloc(sizeof(struct ca91cx42_dma_entry), GFP_KERNEL);
entry = kmalloc(sizeof(struct ca91cx42_dma_entry), GFP_KERNEL);
if (entry == NULL) {
dev_err(dev, "Failed to allocate memory for dma resource "
"structure\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/vme/bridges/vme_tsi148.c
Original file line number Diff line number Diff line change
Expand Up @@ -2309,7 +2309,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (err_chk) {
master_num--;

tsi148_device->flush_image = (struct vme_master_resource *)
tsi148_device->flush_image =
kmalloc(sizeof(struct vme_master_resource), GFP_KERNEL);
if (tsi148_device->flush_image == NULL) {
dev_err(&pdev->dev, "Failed to allocate memory for "
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/vt6655/device_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3025,7 +3025,7 @@ int Config_FileOperation(PSDevice pDevice,BOOL fwrite,unsigned char *Parameter)
goto error1;
}

buffer = (UCHAR *)kmalloc(1024, GFP_KERNEL);
buffer = kmalloc(1024, GFP_KERNEL);
if(buffer==NULL) {
printk("alllocate mem for file fail?\n");
result = -1;
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/vt6655/hostap.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)

DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name);

pDevice->apdev = (struct net_device *)kmalloc(sizeof(struct net_device), GFP_KERNEL);
pDevice->apdev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
if (pDevice->apdev == NULL)
return -ENOMEM;
memset(pDevice->apdev, 0, sizeof(struct net_device));
Expand Down Expand Up @@ -768,7 +768,7 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
p->length > VIAWGET_HOSTAPD_MAX_BUF_SIZE || !p->pointer)
return -EINVAL;

param = (struct viawget_hostapd_param *) kmalloc((int)p->length, (int)GFP_KERNEL);
param = kmalloc((int)p->length, (int)GFP_KERNEL);
if (param == NULL)
return -ENOMEM;

Expand Down
Loading

0 comments on commit 3241487

Please sign in to comment.