staging: wlan-ng: p80211conv.h: warning I don't understand
Hello all, I am new to the realm of linux kernel development. I've been sending in small patches to fix check-patch warnings. I was fixing up the file listed in the subject when I came across this warning. drivers/staging/wlan-ng/p80211conv.c:622: WARNING: Possible unnecessary 'out of memory' message Source Code: if (rxmeta == NULL) { netdev_err(wlandev->netdev, "%s: Failed to allocate rxmeta.\n", wlandev->name); result = 1; goto exit; } What is this warning about? How do I go about fixing it? Thank you, --Gavin
I realized there is a typo in the subject, the file is p80211conv.c and not .h ________________________________ From: kernelnewbies-bounces@kernelnewbies.org [kernelnewbies-bounces@kernelnewbies.org] on behalf of Gavin O'Leary [goleary1@hwemail.com] Sent: Wednesday, November 11, 2015 6:33 PM To: kernelnewbies@kernelnewbies.org Subject: staging: wlan-ng: p80211conv.h: warning I don't understand Hello all, I am new to the realm of linux kernel development. I've been sending in small patches to fix check-patch warnings. I was fixing up the file listed in the subject when I came across this warning. drivers/staging/wlan-ng/p80211conv.c:622: WARNING: Possible unnecessary 'out of memory' message Source Code: if (rxmeta == NULL) { netdev_err(wlandev->netdev, "%s: Failed to allocate rxmeta.\n", wlandev->name); result = 1; goto exit; } What is this warning about? How do I go about fixing it? Thank you, --Gavin
On Thu, 12 Nov 2015 02:55:40 +0000, "Gavin O'Leary" said:
What is this warning about? How do I go about fixing it?
Thank you,
Let's cut-n-paste 2 more lines out of the file: 613 /* Allocate the rxmeta */ 614 rxmeta = kzalloc(sizeof(struct p80211_rxmeta), GFP_ATOMIC); 615 616 if (rxmeta == NULL) { 617 netdev_err(wlandev->netdev, 618 "%s: Failed to allocate rxmeta.\n", wlandev->name); 619 result = 1; 620 goto exit; 621 } Lesson 1: Under what conditions will the kzalloc return NULL? If this happens, what are the chances you'll have a chance to *see* the message? (Hint - what size is that struct? If the kernel can't find that much free memory, what are the chances you still have a functional syslog daemon?) Lesson 2: The wisest thing ever said about checkpatch.pl: " the code is more what you'd call "guidelines" than actual rules." -- Captain Barbossa
On Thu, Nov 12, 2015 at 02:33:07AM +0000, Gavin O'Leary wrote:
Hello all,
I am new to the realm of linux kernel development. I've been sending in small patches to fix check-patch warnings. I was fixing up the file listed in the subject when I came across this warning.
drivers/staging/wlan-ng/p80211conv.c:622: WARNING: Possible unnecessary 'out of memory' message
Source Code:
if (rxmeta == NULL) { netdev_err(wlandev->netdev, "%s: Failed to allocate rxmeta.\n", wlandev->name); result = 1; goto exit; }
What is this warning about? How do I go about fixing it?
A "meta" comment, if you don't understand the warning, why would you want to do anything about it? thanks, greg k-h
Am 2015-11-12 04:54, schrieb Greg KH:
On Thu, Nov 12, 2015 at 02:33:07AM +0000, Gavin O'Leary wrote:
Hello all,
I am new to the realm of linux kernel development. I've been sending in small patches to fix check-patch warnings. I was fixing up the file listed in the subject when I came across this warning.
drivers/staging/wlan-ng/p80211conv.c:622: WARNING: Possible unnecessary 'out of memory' message
Source Code:
if (rxmeta == NULL) { netdev_err(wlandev->netdev, "%s: Failed to allocate rxmeta.\n", wlandev->name); result = 1; goto exit; }
What is this warning about? How do I go about fixing it?
A "meta" comment, if you don't understand the warning, why would you want to do anything about it?
I assume he/she wants to learn and help. Supporting him/her in that endeavor is the right thing to do. Cheers, Silvan
participants (4)
-
Gavin O'Leary -
Greg KH -
Silvan Jegen -
Valdis.Kletnieks@vt.edu