From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jaroslav Kysela <perex@perex.cz>
Cc: Vinod Koul <vinod.koul@linux.intel.com>,
alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.de>,
kernel-janitors@vger.kernel.org,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Jesper Juhl <jj@chaosbits.net>,
Namarta Kohli <namartax.kohli@intel.com>
Subject: [patch] ALSA: compress_core: fix open flags test in snd_compr_open()
Date: Tue, 11 Sep 2012 11:12:43 +0000 [thread overview]
Message-ID: <20120911111243.GC22259@elgon.mountain> (raw)
O_RDONLY is zero so the original test (f->f_flags & O_RDONLY) is always
false and it will never do compress capture. The test for O_WRONLY is
also slightly off. The original test would consider "->flags (O_WRONLY | O_RDWR)" as write only instead of rejecting it as invalid.
I've also removed the pr_err() because that could flood dmesg.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index ec2118d..eb60cb8 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -80,14 +80,12 @@ static int snd_compr_open(struct inode *inode, struct file *f)
int maj = imajor(inode);
int ret;
- if (f->f_flags & O_WRONLY)
+ if ((f->f_flags & O_ACCMODE) = O_WRONLY)
dirn = SND_COMPRESS_PLAYBACK;
- else if (f->f_flags & O_RDONLY)
+ else if ((f->f_flags & O_ACCMODE) = O_RDONLY)
dirn = SND_COMPRESS_CAPTURE;
- else {
- pr_err("invalid direction\n");
+ else
return -EINVAL;
- }
if (maj = snd_major)
compr = snd_lookup_minor_data(iminor(inode),
next reply other threads:[~2012-09-11 11:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-11 11:12 Dan Carpenter [this message]
2012-09-11 12:28 ` [patch] ALSA: compress_core: fix open flags test in snd_compr_open() Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120911111243.GC22259@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=alsa-devel@alsa-project.org \
--cc=jj@chaosbits.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=namartax.kohli@intel.com \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=tiwai@suse.de \
--cc=vinod.koul@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox