mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] ASoC: cs35l56: Fix unsigned 'rv' comparison with zero in cs35l56_irq()
@ 2023-03-23 16:58 Harshit Mogalapalli
  2023-04-04 11:45 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Harshit Mogalapalli @ 2023-03-23 16:58 UTC (permalink / raw)
  Cc: error27, Harshit Mogalapalli, James Schulman, David Rhodes,
	Lucas Tanure, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Simon Trimmer, alsa-devel,
	patches, linux-kernel

'rv' is of type unsigned int, which can never be less than zero.

	rv = pm_runtime_resume_and_get(cs35l56->dev);
	if (rv < 0) { // can never be true.
		...
	}

As pm_runtime_resume_and_get returns integers, change the type of 'rv'
to int to fix this.

This is found by static analysis with smatch.

Fixes: e49611252900 ("ASoC: cs35l56: Add driver for Cirrus Logic CS35L56")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
Only compile tested.
---
 sound/soc/codecs/cs35l56.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index 90fc79b5666d..b3772005668a 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -321,7 +321,8 @@ irqreturn_t cs35l56_irq(int irq, void *data)
 	struct cs35l56_private *cs35l56 = data;
 	unsigned int status1 = 0, status8 = 0, status20 = 0;
 	unsigned int mask1, mask8, mask20;
-	unsigned int rv, val;
+	unsigned int val;
+	int rv;
 	irqreturn_t ret = IRQ_NONE;
 
 	if (!cs35l56->init_done)
-- 
2.38.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH next] ASoC: cs35l56: Fix unsigned 'rv' comparison with zero in cs35l56_irq()
  2023-03-23 16:58 [PATCH next] ASoC: cs35l56: Fix unsigned 'rv' comparison with zero in cs35l56_irq() Harshit Mogalapalli
@ 2023-04-04 11:45 ` Mark Brown
  2023-04-04 17:24   ` Harshit Mogalapalli
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2023-04-04 11:45 UTC (permalink / raw)
  To: Harshit Mogalapalli
  Cc: error27, James Schulman, David Rhodes, Lucas Tanure,
	Richard Fitzgerald, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Simon Trimmer, alsa-devel, patches, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 203 bytes --]

On Thu, Mar 23, 2023 at 09:58:25AM -0700, Harshit Mogalapalli wrote:
> 'rv' is of type unsigned int, which can never be less than zero.

This doesn't apply against current code, please check and resend.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH next] ASoC: cs35l56: Fix unsigned 'rv' comparison with zero in cs35l56_irq()
  2023-04-04 11:45 ` Mark Brown
@ 2023-04-04 17:24   ` Harshit Mogalapalli
  0 siblings, 0 replies; 3+ messages in thread
From: Harshit Mogalapalli @ 2023-04-04 17:24 UTC (permalink / raw)
  To: Mark Brown
  Cc: error27, James Schulman, David Rhodes, Lucas Tanure,
	Richard Fitzgerald, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Simon Trimmer, alsa-devel, patches, linux-kernel

Hi Mark,

On 04/04/23 5:15 pm, Mark Brown wrote:
> On Thu, Mar 23, 2023 at 09:58:25AM -0700, Harshit Mogalapalli wrote:
>> 'rv' is of type unsigned int, which can never be less than zero.
> 
> This doesn't apply against current code, please check and resend.

The reason for the above is that someone else sent a patch next day 
fixing the same bug which got merged in linux-next.

Ref: 
https://lore.kernel.org/all/20230324022303.121485-1-jiapeng.chong@linux.alibaba.com/

So my patch will not apply and is not needed anymore.

Thanks,
Harshit

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-04 18:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 16:58 [PATCH next] ASoC: cs35l56: Fix unsigned 'rv' comparison with zero in cs35l56_irq() Harshit Mogalapalli
2023-04-04 11:45 ` Mark Brown
2023-04-04 17:24   ` Harshit Mogalapalli

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®