diff options
Diffstat (limited to 'sound/pci/asihpi/hpioctl.c')
-rw-r--r-- | sound/pci/asihpi/hpioctl.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index d8e7047512f8..65fcf4770731 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | AudioScience HPI driver | 3 | AudioScience HPI driver |
4 | Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> | 4 | Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of version 2 of the GNU General Public License as | 7 | it under the terms of version 2 of the GNU General Public License as |
@@ -157,11 +157,6 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
157 | goto out; | 157 | goto out; |
158 | } | 158 | } |
159 | 159 | ||
160 | if (hm->h.adapter_index >= HPI_MAX_ADAPTERS) { | ||
161 | err = -EINVAL; | ||
162 | goto out; | ||
163 | } | ||
164 | |||
165 | switch (hm->h.function) { | 160 | switch (hm->h.function) { |
166 | case HPI_SUBSYS_CREATE_ADAPTER: | 161 | case HPI_SUBSYS_CREATE_ADAPTER: |
167 | case HPI_ADAPTER_DELETE: | 162 | case HPI_ADAPTER_DELETE: |
@@ -187,7 +182,6 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
187 | /* -1=no data 0=read from user mem, 1=write to user mem */ | 182 | /* -1=no data 0=read from user mem, 1=write to user mem */ |
188 | int wrflag = -1; | 183 | int wrflag = -1; |
189 | u32 adapter = hm->h.adapter_index; | 184 | u32 adapter = hm->h.adapter_index; |
190 | pa = &adapters[adapter]; | ||
191 | 185 | ||
192 | if ((adapter > HPI_MAX_ADAPTERS) || (!pa->type)) { | 186 | if ((adapter > HPI_MAX_ADAPTERS) || (!pa->type)) { |
193 | hpi_init_response(&hr->r0, HPI_OBJ_ADAPTER, | 187 | hpi_init_response(&hr->r0, HPI_OBJ_ADAPTER, |
@@ -203,6 +197,8 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
203 | goto out; | 197 | goto out; |
204 | } | 198 | } |
205 | 199 | ||
200 | pa = &adapters[adapter]; | ||
201 | |||
206 | if (mutex_lock_interruptible(&adapters[adapter].mutex)) { | 202 | if (mutex_lock_interruptible(&adapters[adapter].mutex)) { |
207 | err = -EINTR; | 203 | err = -EINTR; |
208 | goto out; | 204 | goto out; |