Skip to contentSkip to conversation

OSS: fix error return in dma_ioctl()

PATCH In review Roel Kluin 2 participants 3 messages Nov 12, 2009 Sound

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 OSS: fix error return in dma_ioctl()

The returned error should stay negative

---
 sound/oss/audio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/oss/audio.c +1 -1
index b69c05b..7df48a2 100644
@@ -838,7 +838,7 @@ static int dma_ioctl(int dev, unsigned int cmd, void __user *arg)
 					if ((err = audio_devs[dev]->d->prepare_for_input(dev,
 						     dmap_in->fragment_size, dmap_in->nbufs)) < 0) {
 						spin_unlock_irqrestore(&dmap_in->lock,flags);
-						return -err;
+						return err;
 					}
 					dmap_in->dma_mode = DMODE_INPUT;
 					audio_devs[dev]->enable_bits |= PCM_ENABLE_INPUT;
#1 lore raw

At Thu, 12 Nov 2009 17:43:11 +0100,

Quoted 13 lines · Roel Kluin

The returned error should stay negative

---
 sound/oss/audio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/oss/audio.c +0 -0
index b69c05b..7df48a2 100644

sound/oss/audio.c static int dma_ioctl(int dev, unsigned int cmd, void __user *arg) · line 841

Quoted 5 lines
sound/oss/audio.c +1 -1
@@ -838,7 +838,7 @@ static int dma_ioctl(int dev, unsigned int cmd, void __user *arg)
 					if ((err = audio_devs[dev]->d->prepare_for_input(dev,
 						     dmap_in->fragment_size, dmap_in->nbufs)) < 0) {
 						spin_unlock_irqrestore(&dmap_in->lock,flags);
-						return -err;
+						return err;

Hmm, looks like a wrong fix to me.
Here, err itself is already negative, so you don't need to flip the sign.

thanks,

Takashi

#2 lore raw

At Thu, 12 Nov 2009 18:04:53 +0100,

Quoted 11 lines · I wrote:

At Thu, 12 Nov 2009 17:43:11 +0100,

Quoted 8 lines · Roel Kluin

The returned error should stay negative

---
 sound/oss/audio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 14 lines

sound/oss/audio.c static int dma_ioctl(int dev, unsigned int cmd, void __user *arg) · line 841

Quoted 10 lines
sound/oss/audio.c +1 -1
index b69c05b..7df48a2 100644
@@ -838,7 +838,7 @@ static int dma_ioctl(int dev, unsigned int cmd, void __user *arg)
 					if ((err = audio_devs[dev]->d->prepare_for_input(dev,
 						     dmap_in->fragment_size, dmap_in->nbufs)) < 0) {
 						spin_unlock_irqrestore(&dmap_in->lock,flags);
-						return -err;
+						return err;

Hmm, looks like a wrong fix to me.
Here, err itself is already negative, so you don't need to flip the sign.

My bad, I looked at the patch in a reverse way.
Now applied. Thanks!

Takashi