From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6FFCC32788 for ; Thu, 11 Oct 2018 15:56:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9E2282054F for ; Thu, 11 Oct 2018 15:56:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E2282054F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730804AbeJKXKe (ORCPT ); Thu, 11 Oct 2018 19:10:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:59308 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729967AbeJKXKe (ORCPT ); Thu, 11 Oct 2018 19:10:34 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A516BB0EC; Thu, 11 Oct 2018 15:42:48 +0000 (UTC) Date: Thu, 11 Oct 2018 17:42:48 +0200 Message-ID: From: Takashi Iwai To: "Colin King" Cc: , "Jaroslav Kysela" , , Subject: Re: [PATCH] ALSA: cs4236: fix return check from call to pnp_port_start In-Reply-To: <20181010141542.16100-1-colin.king@canonical.com> References: <20181010141542.16100-1-colin.king@canonical.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/26 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 10 Oct 2018 16:15:42 +0200, Colin King wrote: > > From: Colin Ian King > > Currently the return from pnp_port_start is being checked for validity > by checking if it is greater or equal to zero, however, the return > is unsigned and hence this check is always true. An 0 return from > pnp_port_start is actually an error, so fix the check by checking > for validity when it is non-zero. I guess you're confused between mpu_port[] and mpu_irq[]? The check "mpu_irq[] >= 0" here is to see the module parameter value from user. thanks, Takashi > Detected by CoverityScan, CID#1468334 ("Unsigned compared to 0") > > Fixes: a9824c868a2c ("[ALSA] Add CS4232 PnP BIOS support") > Signed-off-by: Colin Ian King > --- > sound/isa/cs423x/cs4236.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c > index 70559e59d18f..2211c39d2c18 100644 > --- a/sound/isa/cs423x/cs4236.c > +++ b/sound/isa/cs423x/cs4236.c > @@ -292,7 +292,7 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev) > mpu_irq[dev] = SNDRV_AUTO_IRQ; > } else { > mpu_port[dev] = pnp_port_start(pdev, 0); > - if (mpu_irq[dev] >= 0 && > + if (!mpu_irq[dev] && > pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) { > mpu_irq[dev] = pnp_irq(pdev, 0); > } else { > -- > 2.17.1 > >