mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Spooner <nicholas.spooner@seagate.com>
To: rafal@milecki.pl
Cc: dan.carpenter@linaro.org, evan.burgess@seagate.com,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	nicholas.spooner@seagate.com, srinivas.kandagatla@linaro.org
Subject: Re: [PATCH v2] nvmem: u-boot-env: improve error checking
Date: Tue, 30 Jan 2024 16:25:36 -0700	[thread overview]
Message-ID: <20240130232536.1194952-1-nicholas.spooner@seagate.com> (raw)
In-Reply-To: <3292ae5e-07e2-49df-81f7-74e1b5e8dfb3@milecki.pl>

Hi Rafał,

> I'd appreciate description why do we need this change other than
> addressing some Coverity report.

I've been looking at Coverity for bugs to fix when it was brought up on
the kernel-janitors mailing list as a way to gain experience with the
kernel tree. This issue stood out to me specifically because all other
instances of nvmem_add_one_cell (in core.c, onie-tlv.c, and sl28vpd.c) are
checked for errors. I figured I'd add a check for the one in u-boot-env.c
so that they're all covered, but I understand if this is a case where we
don't want to try to fix something that isn't necessarily broken.

> Should a single nvmem_add_one_cell() failure result in not registering
> NVMEM device at all? Why?

I see that the only place where the return value of u_boot_env_add_cells
gets checked is in the same file on line 192, where u_boot_env_parse sets
err. The only time err won't be 0 is if info.name causes u_boot_env_add_cells
to return -ENOMEM. So is that the only case where err should be set, or
should err report if any cells failed to register? I followed the logic
backwards and found that .probe is set to whatever u_boot_env_probe return,
so I'm guessing it's a matter of what .probe should include or not. Let me
know if my logic is incorrect anywhere.

Thanks,
Nick Spooner

      reply	other threads:[~2024-01-30 23:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30 19:42 Nick Spooner
2024-01-30 21:10 ` Rafał Miłecki
2024-01-30 23:25   ` Nick Spooner [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=20240130232536.1194952-1-nicholas.spooner@seagate.com \
    --to=nicholas.spooner@seagate.com \
    --cc=dan.carpenter@linaro.org \
    --cc=evan.burgess@seagate.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafal@milecki.pl \
    --cc=srinivas.kandagatla@linaro.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

all inboxes | Powered by JetHome®