Skip to contentSkip to conversation

sst: fix missing breaks that would cause the wrong operation to execute

PATCH RESEND In review Alan 3 participants 3 messages Apr 6, 2016 – Apr 12, 2016

Subsystems (3)
lore
Share & tools
lore

Alan

author
#0 lore raw

PATCH RESEND 1/1 sst: fix missing breaks that would cause the wrong operation to execute

From: Alan <[email protected]>

Now we correctly error an attempt to execute an unsupported operation. The current code does something else random.

---
 sound/soc/intel/atom/sst-mfld-platform-compress.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
sound/soc/intel/atom/sst-mfld-platform-compress.c +7 -2
index 3951689..1bead81 100644
@@ -182,24 +182,29 @@ static int sst_platform_compr_trigger(struct snd_compr_stream *cstream, int cmd)
 	case SNDRV_PCM_TRIGGER_START:
 		if (stream->compr_ops->stream_start)
 			return stream->compr_ops->stream_start(sst->dev, stream->id);
+		break;
 	case SNDRV_PCM_TRIGGER_STOP:
 		if (stream->compr_ops->stream_drop)
 			return stream->compr_ops->stream_drop(sst->dev, stream->id);
+		break;
 	case SND_COMPR_TRIGGER_DRAIN:
 		if (stream->compr_ops->stream_drain)
 			return stream->compr_ops->stream_drain(sst->dev, stream->id);
+		break;
 	case SND_COMPR_TRIGGER_PARTIAL_DRAIN:
 		if (stream->compr_ops->stream_partial_drain)
 			return stream->compr_ops->stream_partial_drain(sst->dev, stream->id);
+		break;
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 		if (stream->compr_ops->stream_pause)
 			return stream->compr_ops->stream_pause(sst->dev, stream->id);
+		break;
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		if (stream->compr_ops->stream_pause_release)
 			return stream->compr_ops->stream_pause_release(sst->dev, stream->id);
-	default:
-		return -EINVAL;
+		break;
 	}
+	return -EINVAL;
 }
 
 static int sst_platform_compr_pointer(struct snd_compr_stream *cstream,
#1 lore raw
Quoted 6 lines · Alan

From: Alan <[email protected]>

Now we correctly error an attempt to execute an unsupported operation. The current code does something else random.

I think this is nice fix. + Vinod who is the owner of the atom sound driver.

Thanks,
~Keyon

Quoted 42 lines
---
  sound/soc/intel/atom/sst-mfld-platform-compress.c |    9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
sound/soc/intel/atom/sst-mfld-platform-compress.c +7 -2
index 3951689..1bead81 100644
@@ -182,24 +182,29 @@ static int sst_platform_compr_trigger(struct snd_compr_stream *cstream, int cmd)
  	case SNDRV_PCM_TRIGGER_START:
  		if (stream->compr_ops->stream_start)
  			return stream->compr_ops->stream_start(sst->dev, stream->id);
+		break;
  	case SNDRV_PCM_TRIGGER_STOP:
  		if (stream->compr_ops->stream_drop)
  			return stream->compr_ops->stream_drop(sst->dev, stream->id);
+		break;
  	case SND_COMPR_TRIGGER_DRAIN:
  		if (stream->compr_ops->stream_drain)
  			return stream->compr_ops->stream_drain(sst->dev, stream->id);
+		break;
  	case SND_COMPR_TRIGGER_PARTIAL_DRAIN:
  		if (stream->compr_ops->stream_partial_drain)
  			return stream->compr_ops->stream_partial_drain(sst->dev, stream->id);
+		break;
  	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
  		if (stream->compr_ops->stream_pause)
  			return stream->compr_ops->stream_pause(sst->dev, stream->id);
+		break;
  	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
  		if (stream->compr_ops->stream_pause_release)
  			return stream->compr_ops->stream_pause_release(sst->dev, stream->id);
-	default:
-		return -EINVAL;
+		break;
  	}
+	return -EINVAL;
  }
 
  static int sst_platform_compr_pointer(struct snd_compr_stream *cstream,
Acked-by
#2 lore raw
Quoted 7 lines · Yang Jie
Quoted 4 lines · Alan

From: Alan <[email protected]>

Now we correctly error an attempt to execute an unsupported operation. The current code does something else random.

Hi Alan,

Can you either send me this patch or send this to ALSA mailing list.

You might want to add the subsystem name which here should be:

ASoC: Intel: atom: fix missing breaks that would cause the wrong operation to execute

And you can add my Ack :)

Thanks

Signature · 1 line
~Vinod
Quoted 50 lines
Quoted 2 lines

I think this is nice fix. + Vinod who is the owner of the atom sound driver.

Thanks,
~Keyon

Quoted 42 lines
---
 sound/soc/intel/atom/sst-mfld-platform-compress.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
sound/soc/intel/atom/sst-mfld-platform-compress.c +7 -2
index 3951689..1bead81 100644
@@ -182,24 +182,29 @@ static int sst_platform_compr_trigger(struct snd_compr_stream *cstream, int cmd)
 	case SNDRV_PCM_TRIGGER_START:
 		if (stream->compr_ops->stream_start)
 			return stream->compr_ops->stream_start(sst->dev, stream->id);
+		break;
 	case SNDRV_PCM_TRIGGER_STOP:
 		if (stream->compr_ops->stream_drop)
 			return stream->compr_ops->stream_drop(sst->dev, stream->id);
+		break;
 	case SND_COMPR_TRIGGER_DRAIN:
 		if (stream->compr_ops->stream_drain)
 			return stream->compr_ops->stream_drain(sst->dev, stream->id);
+		break;
 	case SND_COMPR_TRIGGER_PARTIAL_DRAIN:
 		if (stream->compr_ops->stream_partial_drain)
 			return stream->compr_ops->stream_partial_drain(sst->dev, stream->id);
+		break;
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 		if (stream->compr_ops->stream_pause)
 			return stream->compr_ops->stream_pause(sst->dev, stream->id);
+		break;
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		if (stream->compr_ops->stream_pause_release)
 			return stream->compr_ops->stream_pause_release(sst->dev, stream->id);
-	default:
-		return -EINVAL;
+		break;
 	}
+	return -EINVAL;
 }
 
 static int sst_platform_compr_pointer(struct snd_compr_stream *cstream,