cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Markus Elfring <Markus.Elfring@web.de>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	Aneesh Kumar K.V <aneesh.kumar@kernel.org>,
	"Naveen N. Rao" <naveen.n.rao@linux.ibm.com>,
	Nicholas Piggin <npiggin@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, "cocci@inria.fr" <cocci@inria.fr>
Subject: Re: [cocci] [0/2] powerpc/powernv/vas: Adjustments for two function implementations
Date: Tue, 16 Apr 2024 11:32:51 +0000	[thread overview]
Message-ID: <795ca003-4231-45c0-8bb6-178597950fa5@csgroup.eu> (raw)
In-Reply-To: <87plupbm0c.fsf@mail.lhotse>



Le 16/04/2024 à 13:11, Michael Ellerman a écrit :
> Markus Elfring <Markus.Elfring@web.de> writes:
>>> A few update suggestions were taken into account
>>> from static source code analysis.
>>>
>>> Markus Elfring (2):
>>
>> I would appreciate a bit more information about the reasons
>> why this patch series was rejected.
>>
>>
>>>    One function call less in vas_window_alloc() after error detection
>>
>> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/1f1c21cf-c34c-418c-b00c-8e6474f12612@web.de/
> 
> It introduced a new goto and label to avoid a kfree(NULL) call, but
> kfree() explicitly accepts NULL and handles it. So it complicates the
> source code for no gain.

This is explicit in Kernel documentation:

/**
  * kfree - free previously allocated memory
  * @object: pointer returned by kmalloc() or kmem_cache_alloc()
  *
  * If @object is NULL, no operation is performed.
  */

That's exactly the same behaviour as free() in libc.

So Coccinelle should be fixed if it reports an error for that.

> 
>>>    Return directly after a failed kasprintf() in map_paste_region()
>>
>> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/f46f04bc-613c-4e98-b602-4c5120556b09@web.de/
> 
> Basically the same reasoning. And it also changes the function from
> having two return paths (success and error), to three.
> 

Looking at that function, I however see a missing region release when 
ioremap_cache() fails.

Christophe

  reply	other threads:[~2024-04-16 12:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-23 19:15 [cocci] [PATCH 0/2] powerpc/powernv/vas: Adjustments for two function implementations Markus Elfring
2023-12-23 19:20 ` [cocci] [PATCH 1/2] powerpc/powernv/vas: One function call less in vas_window_alloc() after error detection Markus Elfring
2023-12-23 19:22 ` [cocci] [PATCH 2/2] powerpc/powernv/vas: Return directly after a failed kasprintf() in map_paste_region() Markus Elfring
2024-04-15  7:42 ` [cocci] [0/2] powerpc/powernv/vas: Adjustments for two function implementations Markus Elfring
2024-04-16 11:11   ` Michael Ellerman
2024-04-16 11:32     ` Christophe Leroy [this message]
2024-04-16 12:14       ` Markus Elfring
2024-04-16 12:18         ` Christophe Leroy
2024-04-16 12:56           ` Julia Lawall
2024-04-16 13:05             ` Markus Elfring
2024-04-16 14:05       ` [cocci] [0/2] powerpc/powernv/vas: Adjustments for map_paste_region()? Markus Elfring
2024-04-16 12:04     ` [cocci] [0/2] powerpc/powernv/vas: Adjustments for two function implementations Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=795ca003-4231-45c0-8bb6-178597950fa5@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=Markus.Elfring@web.de \
    --cc=aneesh.kumar@kernel.org \
    --cc=cocci@inria.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).