Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-mmc@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Yang Yingliang <yangyingliang@huawei.com>,
	LKML <linux-kernel@vger.kernel.org>,
	cocci@inria.fr
Subject: Re: [cocci] mmc: mmc_spi: Adjust error handling in mmc_spi_probe()
Date: Wed, 27 Dec 2023 18:28:26 +0100	[thread overview]
Message-ID: <017f212f-fb55-42ca-bc1c-7f2522194a9f@web.de> (raw)
In-Reply-To: <ZYxXTVpLfI-mgxF4@smile.fi.intel.com>

>> The kfree() function was called in one case by
>> the mmc_spi_probe() function during error handling
>> even if the passed variable contained a null pointer.
>> This issue was detected by using the Coccinelle software.
>
>> * Thus return directly after a call of the function “kmalloc” failed
>>   at the beginning.
>>
>> * Move an error code assignment into an if branch.
>
> How is this one better?

I suggest to avoid a bit of redundant data processing also at this source code place.

Regards,
Markus

      parent reply	other threads:[~2023-12-27 17:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-27 11:50 [cocci] [PATCH] mmc: mmc_spi: Adjust error handling in mmc_spi_probe() Markus Elfring
     [not found] ` <ZYxXTVpLfI-mgxF4@smile.fi.intel.com>
2023-12-27 17:28   ` Markus Elfring [this message]

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=017f212f-fb55-42ca-bc1c-7f2522194a9f@web.de \
    --to=markus.elfring@web.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=cocci@inria.fr \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ulf.hansson@linaro.org \
    --cc=yangyingliang@huawei.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 read-only IMAP folder(s) and NNTP newsgroup(s).