[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58d6b9d0-a2d6-4d8d-bc36-fe783839ca79@web.de>
Date: Thu, 11 Jan 2024 13:03:51 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Lee Jones <lee@...nel.org>, linux-leds@...r.kernel.org,
kernel-janitors@...r.kernel.org
Cc: Pavel Machek <pavel@....cz>, LKML <linux-kernel@...r.kernel.org>,
cocci@...ia.fr
Subject: Re: leds: trigger: oneshot: One function call less in pattern_init()
after error detection
>> The kfree() function was called in one case by
>> the pattern_init() function during error handling
>> even if the passed variable contained a null pointer.
>
> It's totally valid to call kfree() on a NULL pointer:
>
> * If @object is NULL, no operation is performed.
>
> Why do we care all that much?
Would you dare to categorise such special function calls as redundant?
Should they be skipped in more cases?
See also:
https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources
Regards,
Markus
Powered by blists - more mailing lists