From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Mark Brown <broonie@kernel.org>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
David Rhodes <david.rhodes@cirrus.com>,
Richard Fitzgerald <rf@opensource.cirrus.com>,
linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org,
patches@opensource.cirrus.com
Subject: Re: [PATCH 3/4] spi: cs42l43: Make handling missing spk-id GPIOs explicit
Date: Mon, 6 Jan 2025 13:02:54 +0100 [thread overview]
Message-ID: <236ec8fe-b562-4242-a1db-48d1744f9d51@linaro.org> (raw)
In-Reply-To: <Z3u/PNryXkda7GyO@opensource.cirrus.com>
On 06/01/2025 12:32, Charles Keepax wrote:
> On Sat, Jan 04, 2025 at 09:54:36PM +0100, Krzysztof Kozlowski wrote:
>> gpiod_get_array_optional() for spk-id GPIOs can return NULL, if they are
>> missing, so do not pass the value to PTR_ERR but instead explicitly
>> treat NULL as acceptable condition. The old code was correct, but
>> misleading because PTR_ERR usually is used on errors.
>>
>> Reported by Smatch:
>> drivers/spi/spi-cs42l43.c:241 cs42l43_get_speaker_id_gpios() warn: passing zero to 'PTR_ERR'
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> ---
>> drivers/spi/spi-cs42l43.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/spi/spi-cs42l43.c b/drivers/spi/spi-cs42l43.c
>> index ceefc253c549..90180662c4c2 100644
>> --- a/drivers/spi/spi-cs42l43.c
>> +++ b/drivers/spi/spi-cs42l43.c
>> @@ -237,7 +237,9 @@ static int cs42l43_get_speaker_id_gpios(struct cs42l43_spi *priv, int *result)
>> int i, ret;
>>
>> descs = gpiod_get_array_optional(priv->dev, "spk-id", GPIOD_IN);
>> - if (IS_ERR_OR_NULL(descs))
>> + if (!descs)
>> + return 0;
>> + else if (IS_ERR_OR_NULL(descs))
>
> Should switch to using just IS_ERR() if adding an explicit case
> for the NULL. Otherwise looks good to me.
Yes, of course. I'll fix it in v2.
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-01-06 12:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-04 20:54 [PATCH 1/4] spi: atmel-quadspi: Fix struct atmel_qspi_pcal kerneldoc Krzysztof Kozlowski
2025-01-04 20:54 ` [PATCH 2/4] spi: atmel-quadspi: Fix printed error code during DMA setup Krzysztof Kozlowski
2025-01-04 20:54 ` [PATCH 3/4] spi: cs42l43: Make handling missing spk-id GPIOs explicit Krzysztof Kozlowski
2025-01-06 11:32 ` Charles Keepax
2025-01-06 12:02 ` Krzysztof Kozlowski [this message]
2025-01-04 20:54 ` [PATCH 4/4] spi: cadence-quadspi: Assume device could match via platform Krzysztof Kozlowski
2025-01-06 12:35 ` [PATCH 1/4] spi: atmel-quadspi: Fix struct atmel_qspi_pcal kerneldoc Mark Brown
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=236ec8fe-b562-4242-a1db-48d1744f9d51@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=alexandre.belloni@bootlin.com \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=david.rhodes@cirrus.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=patches@opensource.cirrus.com \
--cc=rf@opensource.cirrus.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
all inboxes | Powered by JetHome®