Linux IIO development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Maxwell Doose <m32285159@gmail.com>
Cc: jic23@kernel.org,
	"Tomasz Duszynski" <tomasz.duszynski@octakon.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"open list:IIO SUBSYSTEM AND DRIVERS" <linux-iio@vger.kernel.org>,
	"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iio: chemical: scd30: Cleanup initializations in scd30_float_to_fp()
Date: Sun, 10 May 2026 12:15:28 +0300	[thread overview]
Message-ID: <agBMsBIHknCVhut7@ashevche-desk.local> (raw)
In-Reply-To: <20260508225501.86448-1-m32285159@gmail.com>

On Fri, May 08, 2026 at 05:55:00PM -0500, Maxwell Doose wrote:
> The current variable declaration and initializations are barely readable
> and use comma separations across multiple lines. Refactor the
> initializations so that mantissa and exp have separate declarations and
> sign gets initialized later.

The change LGTM,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

...

>  ps:
>  Hi Jonathan, I noticed a potential divide-by-zero bug on line 241 in
>  scd30_read_raw(), where the value of tmp is dictated by hardware.
>  If the scd30_command_read() call on line 236 assigns 0 to tmp, then
>  when we run:
>  *val2 = 1000000000 / tmp;
>  we'll get a divide-by-zero. Will send a patch for this later.

Have you checked the Clang and GCC compiled code in that cases?
Do they put anything interesting in the binary? (I.o.w. can they prove
the division-by-zero at compile-time?)

See the (somehow) related case in the 7e5c0f97c66a ("iio: adc: nxp-sar-adc:
Avoid division by zero"), which is in Linux Next only (for now).

-- 
With Best Regards,
Andy Shevchenko



      parent reply	other threads:[~2026-05-10  9:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 22:55 [PATCH] iio: chemical: scd30: Cleanup initializations in scd30_float_to_fp() Maxwell Doose
2026-05-09  2:43 ` Sanjay Chitroda
2026-05-09 12:27   ` Maxwell Doose
2026-05-10  9:21     ` Andy Shevchenko
2026-05-10  9:15 ` Andy Shevchenko [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=agBMsBIHknCVhut7@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m32285159@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=tomasz.duszynski@octakon.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