chrome-platform.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Tzung-Bi Shih <tzungbi@kernel.org>,
	chrome-platform@lists.linux.dev, kernel-janitors@vger.kernel.org
Cc: "Benson Leung" <bleung@chromium.org>,
	"Günter Röck" <groeck@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: platform/chrome: cros_ec_i2c: Less function calls in cros_ec_cmd_xfer_i2c() after error detection
Date: Wed, 3 Jan 2024 08:56:50 +0100	[thread overview]
Message-ID: <8175d102-e1ba-4956-a54a-e734f4d99ecf@web.de> (raw)
In-Reply-To: <ZZTVtOumDlR4iZPa@google.com>

>> The kfree() function was called in up to two cases by
>> the cros_ec_cmd_xfer_i2c() function during error handling
>> even if the passed variable contained a null pointer.
>> This issue was detected by using the Coccinelle software.
>>
>> * Adjust jump targets.
>>
>> * Delete two initialisations which became unnecessary
>>   with this refactoring.
>
> The patch saves few instructions but makes the code less readable a bit.

Do you find advices applicable from another information source
also for this function implementation?
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

      reply	other threads:[~2024-01-03  7:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28  7:56 [PATCH] platform/chrome: cros_ec_i2c: Less function calls in cros_ec_cmd_xfer_i2c() after error detection Markus Elfring
2024-01-03  3:34 ` Tzung-Bi Shih
2024-01-03  7:56   ` 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=8175d102-e1ba-4956-a54a-e734f4d99ecf@web.de \
    --to=markus.elfring@web.de \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=groeck@chromium.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tzungbi@kernel.org \
    /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).