ar9170: Fix illegal kfree_skb
PATCH 1/1 ar9170: Fix illegal kfree_skb
Signed-off-by Senthil Balasubramanian <[email protected]>
--- drivers/net/wireless/ath/ar9170/main.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ar9170/main.c +2 -1
@@ -2517,7 +2517,7 @@ void *ar9170_alloc(size_t priv_size) skb =__dev_alloc_skb (AR9170_MAX_RX_BUFFER_SIZE ,GFP_KERNEL );if (!skb) - goto err_nomem; + goto err_out; hw =ieee80211_alloc_hw (priv_size, &ar9170_ops);if (!hw)
@@ -2574,6 +2574,7 @@ void *ar9170_alloc(size_t priv_size) err_nomem:kfree_skb (skb); +err_out:return ERR_PTR (-ENOMEM ); }
Signature · 1 line
1.7.0.1
Quoted 19 lines · On Thursday 04 March 2010 14:28:33 Senthil Balasubramanian wrote:
Signed-off-by Senthil Balasubramanian <[email protected]>--- drivers/net/wireless/ath/ar9170/main.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/net/wireless/ath/ar9170/main.c +1
-1@@ -2517,7 +2517,7 @@ void *ar9170_alloc(size_t priv_size) skb =__dev_alloc_skb (AR9170_MAX_RX_BUFFER_SIZE ,GFP_KERNEL );if (!skb) - goto err_nomem; + goto err_out; hw =ieee80211_alloc_hw (priv_size, &ar9170_ops);if (!hw)
drivers/net/wireless/ath/ar9170/main.c void *ar9170_alloc(size_t priv_size) · line 2579
Quoted 6 lines
drivers/net/wireless/ath/ar9170/main.c +1
-0@@ -2574,6 +2574,7 @@ void *ar9170_alloc(size_t priv_size) err_nomem:kfree_skb (skb); +err_out:return ERR_PTR (-ENOMEM ); }
err, wait. It's perfectly legal to call kfree_skb(NULL). This is also true for most other kfree* functions.
But, if you can't stand this freeing NULL business (e.g.: prop. mem checker?), then why not got the direct path and replace "goto err_nomem" with "return ERR_PTR(-ENOMEM)"?
Regards,
Chr