From: "Rivera-Matos, Ricardo" <rriveram@opensource.cirrus.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Vlad Karpovich <vkarpovi@opensource.cirrus.com>,
James Schulman <james.schulman@cirrus.com>,
David Rhodes <david.rhodes@cirrus.com>,
"Richard Fitzgerald" <rf@opensource.cirrus.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>, Rob Herring <robh+dt@kernel.org>,
<alsa-devel@alsa-project.org>, <patches@opensource.cirrus.com>,
<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>
Subject: Re: [PATCH v3 1/4] ASoC: cs35l45: Checks index of cs35l45_irqs[]
Date: Thu, 7 Sep 2023 14:40:14 -0500 [thread overview]
Message-ID: <0FA27CCC-83F1-4358-B914-35C0FF135A06@opensource.cirrus.com> (raw)
In-Reply-To: <20230901084843.GZ103419@ediswmail.ad.cirrus.com>
> On Sep 1, 2023, at 3:48 AM, Charles Keepax <ckeepax@opensource.cirrus.com> wrote:
>
> On Thu, Aug 31, 2023 at 11:20:39AM -0500, Vlad Karpovich wrote:
>> From: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
>>
>> Checks the index computed by the virq offset before printing the
>> error condition in cs35l45_spk_safe_err() handler.
>>
>> Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
>> Signed-off-by: Vlad Karpovich <vkarpovi@opensource.cirrus.com>
>> ---
>> sound/soc/codecs/cs35l45.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/sound/soc/codecs/cs35l45.c b/sound/soc/codecs/cs35l45.c
>> index 2ac4612402eb..02b1172d2647 100644
>> --- a/sound/soc/codecs/cs35l45.c
>> +++ b/sound/soc/codecs/cs35l45.c
>> @@ -1023,7 +1023,10 @@ static irqreturn_t cs35l45_spk_safe_err(int irq, void *data)
>>
>> i = irq - regmap_irq_get_virq(cs35l45->irq_data, 0);
>>
>> - dev_err(cs35l45->dev, "%s condition detected!\n", cs35l45_irqs[i].name);
>> + if (i < 0 || i >= ARRAY_SIZE(cs35l45_irqs))
>
> I am happy enough for this to be merged, since it clearly does
> no harm. So:
>
> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
>
> But I do still have a slight reservation of what is the point
> of this error check? This handler is static and can only be
> called from within cs35l45.c and the only code that registers
> IRQs goes through the cs35l45_irqs array and registers IRQs
> from there, so how does this ever end up with i being out of
> bounds?
>
> And whilst I would not add this to this patch. I do also think
> perhaps Ricardo had a point in his email, the IRQ handler
> should probably be renamed, since it handles more than just
> the spk_safe_err's, perhaps something like cs35l45_report_err.
> On why the watchdog and global error call this as well, that
> was a review comment on an earlier patch since the handlers for
> those errors only printed a message, they might as well be
> combined with the spk_safe error that also only printed a
> message. If at some point separate handling is added for them
> they can be split out.
Thanks Charles, I had missed that comment. It’s clear to me now.
>
> Thanks,
> Charles
Acked-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com <mailto:rriveram@opensource.cirrus.com>>
next prev parent reply other threads:[~2023-09-07 19:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-31 16:20 Vlad Karpovich
2023-08-31 16:20 ` [PATCH v3 2/4] ASoC: cs35l45: Analog PCM Volume and Amplifier Mode controls Vlad Karpovich
2023-09-01 8:50 ` Charles Keepax
2023-08-31 16:20 ` [PATCH v3 3/4] ASoC: cs35l45: Connect DSP to the monitoring signals Vlad Karpovich
2023-09-01 8:50 ` Charles Keepax
2023-09-07 19:48 ` Rivera-Matos, Ricardo
2023-08-31 16:20 ` [PATCH v3 4/4] ASoC: cs35l45: Add AMP Enable Switch control Vlad Karpovich
2023-09-01 8:50 ` Charles Keepax
2023-09-07 19:49 ` Rivera-Matos, Ricardo
2023-09-11 0:27 ` Mark Brown
2023-09-01 8:48 ` [PATCH v3 1/4] ASoC: cs35l45: Checks index of cs35l45_irqs[] Charles Keepax
2023-09-07 19:40 ` Rivera-Matos, Ricardo [this message]
2023-09-11 23:57 ` 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=0FA27CCC-83F1-4358-B914-35C0FF135A06@opensource.cirrus.com \
--to=rriveram@opensource.cirrus.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=david.rhodes@cirrus.com \
--cc=devicetree@vger.kernel.org \
--cc=james.schulman@cirrus.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=perex@perex.cz \
--cc=rf@opensource.cirrus.com \
--cc=robh+dt@kernel.org \
--cc=tiwai@suse.com \
--cc=vkarpovi@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®