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

Dan Carpenter dan.carpenter at oracle.com
Tue Sep 4 18:33:00 CEST 2012


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?

regards,
dan carpenter



More information about the Alsa-devel mailing list