All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Crofts <joshua.crofts1@gmail.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: "Nuno Sá" <nuno.sa@analog.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Liviu Stan" <liviu.stan@analog.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"David Lechner" <dlechner@baylibre.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Uwe Kleine-König (The Capable Hub)"
	<u.kleine-koenig@baylibre.com>, "Pan Chuang" <panchuang@vivo.com>,
	"Shi Hao" <i.shihao.999@gmail.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: temperature: ltc2983: avoid -Wstring-compare warning
Date: Fri, 2 Oct 2026 15:04:25 +0200	[thread overview]
Message-ID: <20261002150425.0000286a@gmail.com> (raw)
In-Reply-To: <20261002124902.3703019-1-arnd@kernel.org>

On Fri,  2 Oct 2026 14:48:51 +0200
Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
> 
> When __ltc2983_custom_sensor_new() is inlined into a caller, gcc notices
> that the string compare can never succeed and warns about this being a
> possible mistake:
> 
> In function '__ltc2983_custom_sensor_new',
>     inlined from 'ltc2983_thermistor_new' at drivers/iio/temperature/ltc2983.c:1079:24:
> drivers/iio/temperature/ltc2983.c:559:29: error: 'strcmp' of a string of length 24 and an array of size 22 evaluates to nonzero [-Werror=string-compare]
>   559 |    if ((index % 2) != 0 && !strcmp(propname, "adi,custom-leak-detector"))
>       |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> This is a false positive warning as the code always works correctly,
> though the strcmp() is a somewhat elaborate way of identifying the caller.
> 
> Rework this by replacing both the strcmp() and the is_steinhart flag with
> the sensor->type that is always available anyway and identifies with
> code path gets taken.
> 
> Fixes: 3dd0c048409e ("iio: temperature: ltc2983: Add support for ADT7604")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Makes sense.

Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>

-- 
Kind regards,
Joshua Crofts

  reply	other threads:[~2026-10-02 13:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 12:48 [PATCH] iio: temperature: ltc2983: avoid -Wstring-compare warning Arnd Bergmann
2026-10-02 13:04 ` Joshua Crofts [this message]
2026-10-02 13:29   ` Andy Shevchenko
2026-10-02 13:36     ` Joshua Crofts
2026-10-03 17:41 ` David Laight

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=20261002150425.0000286a@gmail.com \
    --to=joshua.crofts1@gmail.com \
    --cc=andy@kernel.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=i.shihao.999@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.stan@analog.com \
    --cc=nuno.sa@analog.com \
    --cc=panchuang@vivo.com \
    --cc=u.kleine-koenig@baylibre.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.