* Question on checpatch.pl warning -- possible unnecessary 'out of memory' message.
@ 2014-12-31 13:38 Bas Peters
2014-12-31 19:37 ` Bruno Guedes Souto
2015-01-05 9:49 ` Leon Romanovsky
0 siblings, 2 replies; 3+ messages in thread
From: Bas Peters @ 2014-12-31 13:38 UTC (permalink / raw)
To: kernelnewbies
Dear all,
I'm fixing up my first driver (drivers/isdn/gigaset) to get some
experience submitting patches. When I run checkpatch.pl on some of the
code, I get the following warning:
./drivers/isdn/gigaset/capi.c:337: WARNING: Possible unnecessary 'out of memory' message
The corresponding code is:
cskb = alloc_skb(CAPI_DATA_B3_CONF_LEN, GFP_ATOMIC);
if (!cskb) {
dev_err(cs->dev, "%s: out of memory\n",
__func__);
return;
}
All instances of this warning refer to usage of alloc_skb using the
GFP_ATOMIC flag. Why does checkpatch show this warning? Is it not good
practice to _always_ check whether allocation succeeded or not?
I hope someone can explain the nature of this warning and, if right,
what it should look like.
With kind regards,
Bas Peters
^ permalink raw reply [flat|nested] 3+ messages in thread
* Question on checpatch.pl warning -- possible unnecessary 'out of memory' message.
2014-12-31 13:38 Question on checpatch.pl warning -- possible unnecessary 'out of memory' message Bas Peters
@ 2014-12-31 19:37 ` Bruno Guedes Souto
2015-01-05 9:49 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Bruno Guedes Souto @ 2014-12-31 19:37 UTC (permalink / raw)
To: kernelnewbies
Bas Peters <baspeters93 <at> gmail.com> writes:
>
> I hope someone can explain the nature of this warning and, if right,
> what it should look like.
>
> With kind regards,
>
> Bas Peters
>
Have you googled this particular checkpath error?
You should use a preprocessor macro.
Regards
BGS
^ permalink raw reply [flat|nested] 3+ messages in thread
* Question on checpatch.pl warning -- possible unnecessary 'out of memory' message.
2014-12-31 13:38 Question on checpatch.pl warning -- possible unnecessary 'out of memory' message Bas Peters
2014-12-31 19:37 ` Bruno Guedes Souto
@ 2015-01-05 9:49 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2015-01-05 9:49 UTC (permalink / raw)
To: kernelnewbies
Hi Bas,
> All instances of this warning refer to usage of alloc_skb using the
> GFP_ATOMIC flag. Why does checkpatch show this warning? Is it not good
> practice to _always_ check whether allocation succeeded or not?
>
> I hope someone can explain the nature of this warning and, if right,
> what it should look like.
I suggest you to take a look at the following thread
https://lkml.org/lkml/2014/6/10/382
As a short summary to that discussion:
1. You should check the NULL pointer.
2. You shouldn't print the error.
>
> With kind regards,
>
> Bas Peters
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
--
Leon Romanovsky | Independent Linux Consultant
www.leon.nu | leon at leon.nu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-05 9:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-31 13:38 Question on checpatch.pl warning -- possible unnecessary 'out of memory' message Bas Peters
2014-12-31 19:37 ` Bruno Guedes Souto
2015-01-05 9:49 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).