Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752054AbaLOLdW (ORCPT ); Mon, 15 Dec 2014 06:33:22 -0500 Received: from 251.110.2.81.in-addr.arpa ([81.2.110.251]:42689 "EHLO lxorguk.ukuu.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751339AbaLOLdV (ORCPT ); Mon, 15 Dec 2014 06:33:21 -0500 Subject: [PATCH] doubletalk: probe failure causes OOPS From: Alan Cox To: trivial@kernel.org, linux-kernel@vger.kernel.org, stable@kernel.org Date: Mon, 15 Dec 2014 11:33:08 +0000 Message-ID: <20141215113246.25566.52447.stgit@localhost.localdomain> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/staging/speakup/speakup_dtlk.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/speakup/speakup_dtlk.c b/drivers/staging/speakup/speakup_dtlk.c index d7d5152..ffd85e1 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) static int synth_probe(struct spk_synth *synth) { - unsigned int port_val = 0; + unsigned int port_val = 0; int i = 0; struct synth_settings *sp; @@ -361,7 +361,8 @@ static int synth_probe(struct spk_synth *synth) port_val &= 0xfbff; if (port_val != 0x107f) { pr_info("DoubleTalk PC: not found\n"); - synth_release_region(synth_lpc, SYNTH_IO_EXTENT); + if (synth_lpc) + synth_release_region(synth_lpc, SYNTH_IO_EXTENT); return -ENODEV; } while (inw_p(synth_lpc) != 0x147f) @@ -369,7 +370,7 @@ static int synth_probe(struct spk_synth *synth) sp = synth_interrogate(synth); pr_info("%s: %03x-%03x, ROM ver %s, s/n %u, driver: %s\n", synth->long_name, synth_lpc, synth_lpc+SYNTH_IO_EXTENT - 1, - sp->rom_version, sp->serial_number, synth->version); + sp->rom_version, sp->serial_number, synth->version); synth->alive = 1; return 0; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/