Skip to contentSkip to conversation

mwifiex: remove unneeded kfree(NULL);

PATCH In review Dan Carpenter 2 participants 2 messages Oct 18, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 mwifiex: remove unneeded kfree(NULL);

The previous if statement means this that pointer is NULL so there is no need to free it.

drivers/net/wireless/mwifiex/pcie.c +0 -1
index d34acf0..4466976 100644
@@ -386,7 +386,6 @@ static int mwifiex_pcie_create_txbd_ring(struct mwifiex_adapter *adapter)
 	card->txbd_ring_vbase = kzalloc(card->txbd_ring_size, GFP_KERNEL);
 	if (!card->txbd_ring_vbase) {
 		dev_err(adapter->dev, "Unable to allocate buffer for txbd ring.\n");
-		kfree(card->txbd_ring_vbase);
 		return -1;
 	}
 	card->txbd_ring_pbase = virt_to_phys(card->txbd_ring_vbase);
Acked-by on v1 1/4
#1 lore raw

Hi Dan,

Thanks for your patch series.

Quoted 11 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Monday, October 17, 2011 11:13 PM
To: Bing Zhao
Cc: John W. Linville; [email protected]; [email protected]
Subject: [patch 1/4] mwifiex: remove unneeded kfree(NULL);

The previous if statement means this that pointer is NULL so there is no need to free it.

Regards,
Bing

Quoted 13 lines
drivers/net/wireless/mwifiex/pcie.c +0 -1
index d34acf0..4466976 100644
@@ -386,7 +386,6 @@ static int mwifiex_pcie_create_txbd_ring(struct mwifiex_adapter *adapter)
 	card->txbd_ring_vbase = kzalloc(card->txbd_ring_size, GFP_KERNEL);
 	if (!card->txbd_ring_vbase) {
 		dev_err(adapter->dev, "Unable to allocate buffer for txbd ring.\n");
-		kfree(card->txbd_ring_vbase);
 		return -1;
 	}
 	card->txbd_ring_pbase = virt_to_phys(card->txbd_ring_vbase);