2005-04-13 02:20:18

by Adrian Bunk

[permalink] [raw]
Subject: [2.6 patch] sound/oss/cs46xx.c: fix a check after use

This patch fixes a check after use found by the Coverity checker.

Signed-off-by: Adrian Bunk <[email protected]>

---

This patch was already sent on:
- 27 Mar 2005

--- linux-2.6.12-rc1-mm1-full/sound/oss/cs46xx.c.old 2005-03-23 04:48:53.000000000 +0100
+++ linux-2.6.12-rc1-mm1-full/sound/oss/cs46xx.c 2005-03-23 04:49:31.000000000 +0100
@@ -3086,13 +3086,14 @@

static void amp_hercules(struct cs_card *card, int change)
{
- int old=card->amplifier;
+ int old;
if(!card)
{
CS_DBGOUT(CS_ERROR, 2, printk(KERN_INFO
"cs46xx: amp_hercules() called before initialized.\n"));
return;
}
+ old = card->amplifier;
card->amplifier+=change;
if( (card->amplifier && !old) && !(hercules_egpio_disable))
{


2005-04-13 02:36:45

by Al Viro

[permalink] [raw]
Subject: Re: [2.6 patch] sound/oss/cs46xx.c: fix a check after use

On Wed, Apr 13, 2005 at 04:17:39AM +0200, Adrian Bunk wrote:
> This patch fixes a check after use found by the Coverity checker.

NAK. Please, read the surrounding code. All places that can call
that function have form
<expression>->amplifier_ctrl(<same expression>,...);
so we _can't_ get NULL first argument. The check should be removed -
it's not paranoia, it's simple stupidity.