diff options
author | Eliot Blennerhassett <eblennerhassett@audioscience.com> | 2011-07-27 04:03:51 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-07-27 04:08:26 -0400 |
commit | 767cd365b22820df07b962b49ce04b220b98e537 (patch) | |
tree | 8e436adc58536dc73b16390d122140a67c5e93bb | |
parent | 45eebda7b4a73deb268b0cbcde06b603a2ba46a2 (diff) |
ALSA: asihpi - bug fix pa use before init.
Fixes bug introduced by 1c073b67.
Also declare pa local to block in which it is used.
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/asihpi/hpioctl.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index 65fcf4770731..e0cff0c72e51 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c | |||
@@ -107,7 +107,6 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
107 | union hpi_response_buffer_v1 *hr; | 107 | union hpi_response_buffer_v1 *hr; |
108 | u16 res_max_size; | 108 | u16 res_max_size; |
109 | u32 uncopied_bytes; | 109 | u32 uncopied_bytes; |
110 | struct hpi_adapter *pa = NULL; | ||
111 | int err = 0; | 110 | int err = 0; |
112 | 111 | ||
113 | if (cmd != HPI_IOCTL_LINUX) | 112 | if (cmd != HPI_IOCTL_LINUX) |
@@ -182,6 +181,7 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
182 | /* -1=no data 0=read from user mem, 1=write to user mem */ | 181 | /* -1=no data 0=read from user mem, 1=write to user mem */ |
183 | int wrflag = -1; | 182 | int wrflag = -1; |
184 | u32 adapter = hm->h.adapter_index; | 183 | u32 adapter = hm->h.adapter_index; |
184 | struct hpi_adapter *pa = &adapters[adapter]; | ||
185 | 185 | ||
186 | if ((adapter > HPI_MAX_ADAPTERS) || (!pa->type)) { | 186 | if ((adapter > HPI_MAX_ADAPTERS) || (!pa->type)) { |
187 | hpi_init_response(&hr->r0, HPI_OBJ_ADAPTER, | 187 | hpi_init_response(&hr->r0, HPI_OBJ_ADAPTER, |
@@ -197,9 +197,7 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
197 | goto out; | 197 | goto out; |
198 | } | 198 | } |
199 | 199 | ||
200 | pa = &adapters[adapter]; | 200 | if (mutex_lock_interruptible(&pa->mutex)) { |
201 | |||
202 | if (mutex_lock_interruptible(&adapters[adapter].mutex)) { | ||
203 | err = -EINTR; | 201 | err = -EINTR; |
204 | goto out; | 202 | goto out; |
205 | } | 203 | } |
@@ -235,8 +233,7 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
235 | "stream buffer size %d\n", | 233 | "stream buffer size %d\n", |
236 | size); | 234 | size); |
237 | 235 | ||
238 | mutex_unlock(&adapters | 236 | mutex_unlock(&pa->mutex); |
239 | [adapter].mutex); | ||
240 | err = -EINVAL; | 237 | err = -EINVAL; |
241 | goto out; | 238 | goto out; |
242 | } | 239 | } |
@@ -277,7 +274,7 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
277 | uncopied_bytes, size); | 274 | uncopied_bytes, size); |
278 | } | 275 | } |
279 | 276 | ||
280 | mutex_unlock(&adapters[adapter].mutex); | 277 | mutex_unlock(&pa->mutex); |
281 | } | 278 | } |
282 | 279 | ||
283 | /* on return response size must be set */ | 280 | /* on return response size must be set */ |