[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230829131723.f0df743f3ce9293878422cc3@opensource.cirrus.com>
Date: Tue, 29 Aug 2023 13:17:23 -0500
From: Vlad Karpovich <vkarpovi@...nsource.cirrus.com>
To: Charles Keepax <ckeepax@...nsource.cirrus.com>
CC: James Schulman <james.schulman@...rus.com>,
David Rhodes <david.rhodes@...rus.com>,
Richard Fitzgerald <rf@...nsource.cirrus.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
"Rob Herring" <robh+dt@...nel.org>, <alsa-devel@...a-project.org>,
<patches@...nsource.cirrus.com>, <linux-kernel@...r.kernel.org>,
<devicetree@...r.kernel.org>,
Ricardo Rivera-Matos <rriveram@...nsource.cirrus.com>
Subject: Re: [PATCH 3/7] ASoC: cs35l45: Checks index of cs35l45_irqs[]
On Tue, 29 Aug 2023 10:07:51 +0000
Charles Keepax <ckeepax@...nsource.cirrus.com> wrote:
> On Mon, Aug 28, 2023 at 12:05:21PM -0500, Vlad Karpovich wrote:
> > 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@...nsource.cirrus.com>
> > Signed-off-by: Vlad Karpovich <vkarpovi@...nsource.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 40fb64904260..2c9b41171a05 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 > 6)
>
> This looks a little odd, there appear to be 8 IRQs attached to
> this function whereas this says 6. Also this check seems like
> it will be hard to keep in sync as things change.
>
> Assuming this error check is actually necessary, would it be
> perhaps better to check i is smaller than ARRAY_SIZE(cs35l45_irqs)
> and check that the attached function is cs35l45_spk_safe_err.
> That should be more robust against future changes to the IRQs.
>
> Thanks,
> Charles
Thank you. It was picked up from a different branch,I will change to ARRAY_SIZE.
--
Vlad Karpovich <vkarpovi@...nsource.cirrus.com>
Powered by blists - more mailing lists