diff options
author | Alan Cox <alan@linux.intel.com> | 2014-12-15 06:33:08 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2015-01-20 07:56:05 -0500 |
commit | 7aa4d5c8ffed00ff751f1d8d492ae89d7f3f9736 (patch) | |
tree | 845400d5684f630e97069d6f4427f1d51e628620 | |
parent | b69a7806de1d4073aad2d9e5c9371a7341cf9eaa (diff) |
doubletalk: probe failure causes OOPS
The code bothers to probe for the device, but on failing to find it proceeds
to try and release a NULL resource, thereby ruining it's prior good
behaviour
Resolves-Bug: https://bugzilla.kernel.org/show_bug.cgi?id=88581
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/staging/speakup/speakup_dtlk.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/staging/speakup/speakup_dtlk.c b/drivers/staging/speakup/speakup_dtlk.c index d7d515273896..ffd85e1a885b 100644 --- a/drivers/staging/speakup/speakup_dtlk.c +++ b/drivers/staging/speakup/speakup_dtlk.c | |||
@@ -325,7 +325,7 @@ static struct synth_settings *synth_interrogate(struct spk_synth *synth) | |||
325 | 325 | ||
326 | static int synth_probe(struct spk_synth *synth) | 326 | static int synth_probe(struct spk_synth *synth) |
327 | { | 327 | { |
328 | unsigned int port_val = 0; | 328 | unsigned int port_val = 0; |
329 | int i = 0; | 329 | int i = 0; |
330 | struct synth_settings *sp; | 330 | struct synth_settings *sp; |
331 | 331 | ||
@@ -361,7 +361,8 @@ static int synth_probe(struct spk_synth *synth) | |||
361 | port_val &= 0xfbff; | 361 | port_val &= 0xfbff; |
362 | if (port_val != 0x107f) { | 362 | if (port_val != 0x107f) { |
363 | pr_info("DoubleTalk PC: not found\n"); | 363 | pr_info("DoubleTalk PC: not found\n"); |
364 | synth_release_region(synth_lpc, SYNTH_IO_EXTENT); | 364 | if (synth_lpc) |
365 | synth_release_region(synth_lpc, SYNTH_IO_EXTENT); | ||
365 | return -ENODEV; | 366 | return -ENODEV; |
366 | } | 367 | } |
367 | while (inw_p(synth_lpc) != 0x147f) | 368 | while (inw_p(synth_lpc) != 0x147f) |
@@ -369,7 +370,7 @@ static int synth_probe(struct spk_synth *synth) | |||
369 | sp = synth_interrogate(synth); | 370 | sp = synth_interrogate(synth); |
370 | pr_info("%s: %03x-%03x, ROM ver %s, s/n %u, driver: %s\n", | 371 | pr_info("%s: %03x-%03x, ROM ver %s, s/n %u, driver: %s\n", |
371 | synth->long_name, synth_lpc, synth_lpc+SYNTH_IO_EXTENT - 1, | 372 | synth->long_name, synth_lpc, synth_lpc+SYNTH_IO_EXTENT - 1, |
372 | sp->rom_version, sp->serial_number, synth->version); | 373 | sp->rom_version, sp->serial_number, synth->version); |
373 | synth->alive = 1; | 374 | synth->alive = 1; |
374 | return 0; | 375 | return 0; |
375 | } | 376 | } |