[alsa-devel] ALSA: core: add support for compress_offload

Takashi Iwai tiwai at suse.de
Wed Sep 5 15:36:24 CEST 2012


At Tue, 4 Sep 2012 19:33:00 +0300,
Dan Carpenter wrote:
> 
> Hello Vinod Koul,
> 
> The patch b21c60a4edd2: "ALSA: core: add support for
> compress_offload" from Dec 23, 2011, leads to the following warning:
> sound/core/compress_offload.c:85 snd_compr_open()
> 	 warn: bitwise AND condition is false here
> 
>     83          if (f->f_flags & O_WRONLY)
>     84                  dirn = SND_COMPRESS_PLAYBACK;
>     85          else if (f->f_flags & O_RDONLY)
>     86                  dirn = SND_COMPRESS_CAPTURE;
>     87          else {
>     88                  pr_err("invalid direction\n");
>     89                  return -EINVAL;
>     90          }
> 
> O_RDONLY is 0 so we never do compressed capture.  Perhaps the tests
> should be:
> 
> 	if ((file->f_flags & O_ACCMODE) == O_WRONLY)
> 		dirn = SND_COMPRESS_PLAYBACK;
> 	else if (file->f_flags & O_ACCMODE) == O_RDONLY)
> 		dirn = SND_COMPRESS_CAPTURE;
> 	else
> 		return -EINVAL;
> 
> Also it seems like a bad thing to print an error here, because can the
> user flood dmesg?

Agreed on both points.  Care to send a fix patch?


thanks,

Takashi


More information about the Alsa-devel mailing list