From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Arnav Kapoor <kapoorarnav43@gmail.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Frank Li" <Frank.Li@nxp.com>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
linux-iio@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: adc: fsl-imx25-gcq: check the return value of the
Date: Thu, 22 Oct 2026 19:35:59 +0300 [thread overview]
Message-ID: <ato7b3ydggC9X0_-@ashevche-desk.local> (raw)
In-Reply-To: <20261021225450.628499-1-kapoorarnav43@gmail.com>
On Thu, Oct 22, 2026 at 04:24:45AM +0530, Arnav Kapoor wrote:
> The driver ignores the return value of all the regmap accesses. If one
> of them fails, e.g. because the memory mapped registers can't be
> accessed, the driver just continues with an undefined state.
Can MMIO actually fail? It can give invalid values (due to HW being off or
wrong MMIO window). It can give a page fault, or some other error in HW,
but the read itself most likely never fails.
> The most severe case is the read of the FIFO in
> mx25_gcq_get_raw_value(): the destination variable is not initialized,
> so a failed read leaks uninitialized stack memory to userspace.
>
> Check the return value of all the register accesses and propagate the
> errors to the caller. In the interrupt handler, where there is not much
> that can be done about a failed access, just don't use the content of
> the status register if it can't be read.
I consider this change an unneeded churn until you come up with real life
example of how MMIO fails (at least on this platform, not exactly with this
driver).
Yes, I aware that checking for error codes of regmap is a good manners and
style in general, but would we do jsut that in a standalone change?
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-10-22 16:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 22:54 Arnav Kapoor
2026-10-22 15:55 ` Frank Li
2026-10-22 16:37 ` Andy Shevchenko
2026-10-22 16:35 ` Andy Shevchenko [this message]
2026-10-22 16:44 ` Arnav Kapoor
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=ato7b3ydggC9X0_-@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Frank.Li@nxp.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=jic23@kernel.org \
--cc=kapoorarnav43@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=s.hauer@pengutronix.de \
/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®