diff options
author | Oliver Neukum <oneukum@suse.com> | 2016-03-23 17:36:56 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2016-03-23 20:29:30 -0400 |
commit | d314e9e80c5ea561b73584b73806c2ae9e30f503 (patch) | |
tree | c338d81a66ee7d0642238af6ffe89101221cc1a5 | |
parent | 950336ba3e4a1ffd2ca60d29f6ef386dd2c7351d (diff) |
Input: sur40 - fix DMA on stack
During the initialisation the driver uses a buffer on the stack for DMA.
That violates the cache coherency rules. The fix is to allocate the buffer
with kmalloc().
Signed-off-by: Oliver Neukum <ONeukum@suse.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/touchscreen/sur40.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c index b6c4d03de340..880c40b23f66 100644 --- a/drivers/input/touchscreen/sur40.c +++ b/drivers/input/touchscreen/sur40.c | |||
@@ -197,28 +197,34 @@ static int sur40_command(struct sur40_state *dev, | |||
197 | static int sur40_init(struct sur40_state *dev) | 197 | static int sur40_init(struct sur40_state *dev) |
198 | { | 198 | { |
199 | int result; | 199 | int result; |
200 | u8 buffer[24]; | 200 | u8 *buffer; |
201 | |||
202 | buffer = kmalloc(24, GFP_KERNEL); | ||
203 | if (!buffer) { | ||
204 | result = -ENOMEM; | ||
205 | goto error; | ||
206 | } | ||
201 | 207 | ||
202 | /* stupidly replay the original MS driver init sequence */ | 208 | /* stupidly replay the original MS driver init sequence */ |
203 | result = sur40_command(dev, SUR40_GET_VERSION, 0x00, buffer, 12); | 209 | result = sur40_command(dev, SUR40_GET_VERSION, 0x00, buffer, 12); |
204 | if (result < 0) | 210 | if (result < 0) |
205 | return result; | 211 | goto error; |
206 | 212 | ||
207 | result = sur40_command(dev, SUR40_GET_VERSION, 0x01, buffer, 12); | 213 | result = sur40_command(dev, SUR40_GET_VERSION, 0x01, buffer, 12); |
208 | if (result < 0) | 214 | if (result < 0) |
209 | return result; | 215 | goto error; |
210 | 216 | ||
211 | result = sur40_command(dev, SUR40_GET_VERSION, 0x02, buffer, 12); | 217 | result = sur40_command(dev, SUR40_GET_VERSION, 0x02, buffer, 12); |
212 | if (result < 0) | 218 | if (result < 0) |
213 | return result; | 219 | goto error; |
214 | 220 | ||
215 | result = sur40_command(dev, SUR40_UNKNOWN2, 0x00, buffer, 24); | 221 | result = sur40_command(dev, SUR40_UNKNOWN2, 0x00, buffer, 24); |
216 | if (result < 0) | 222 | if (result < 0) |
217 | return result; | 223 | goto error; |
218 | 224 | ||
219 | result = sur40_command(dev, SUR40_UNKNOWN1, 0x00, buffer, 5); | 225 | result = sur40_command(dev, SUR40_UNKNOWN1, 0x00, buffer, 5); |
220 | if (result < 0) | 226 | if (result < 0) |
221 | return result; | 227 | goto error; |
222 | 228 | ||
223 | result = sur40_command(dev, SUR40_GET_VERSION, 0x03, buffer, 12); | 229 | result = sur40_command(dev, SUR40_GET_VERSION, 0x03, buffer, 12); |
224 | 230 | ||
@@ -226,7 +232,8 @@ static int sur40_init(struct sur40_state *dev) | |||
226 | * Discard the result buffer - no known data inside except | 232 | * Discard the result buffer - no known data inside except |
227 | * some version strings, maybe extract these sometime... | 233 | * some version strings, maybe extract these sometime... |
228 | */ | 234 | */ |
229 | 235 | error: | |
236 | kfree(buffer); | ||
230 | return result; | 237 | return result; |
231 | } | 238 | } |
232 | 239 | ||