diff options
| author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-09-11 07:12:43 -0400 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2012-09-11 08:27:40 -0400 |
| commit | 81cb324675eec592ab8f3038f980c074fbf7fb9b (patch) | |
| tree | 01609ce28354864ee3ce1fb2cc16772f91d495e5 | |
| parent | 07dc59f0988cb54fd87bd373b3b27eb2401dd811 (diff) | |
ALSA: compress_core: fix open flags test in snd_compr_open()
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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
| -rw-r--r-- | sound/core/compress_offload.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index ec2118d0e27a..eb60cb8dbb8a 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) | |||
| 80 | int maj = imajor(inode); | 80 | int maj = imajor(inode); |
| 81 | int ret; | 81 | int ret; |
| 82 | 82 | ||
| 83 | if (f->f_flags & O_WRONLY) | 83 | if ((f->f_flags & O_ACCMODE) == O_WRONLY) |
| 84 | dirn = SND_COMPRESS_PLAYBACK; | 84 | dirn = SND_COMPRESS_PLAYBACK; |
| 85 | else if (f->f_flags & O_RDONLY) | 85 | else if ((f->f_flags & O_ACCMODE) == O_RDONLY) |
| 86 | dirn = SND_COMPRESS_CAPTURE; | 86 | dirn = SND_COMPRESS_CAPTURE; |
| 87 | else { | 87 | else |
| 88 | pr_err("invalid direction\n"); | ||
| 89 | return -EINVAL; | 88 | return -EINVAL; |
| 90 | } | ||
| 91 | 89 | ||
| 92 | if (maj == snd_major) | 90 | if (maj == snd_major) |
| 93 | compr = snd_lookup_minor_data(iminor(inode), | 91 | compr = snd_lookup_minor_data(iminor(inode), |
