From patchwork Wed Jan 22 09:29:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233464 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 5251AC2D0DB for ; Wed, 22 Jan 2020 09:55:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 199C920704 for ; Wed, 22 Jan 2020 09:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579686935; bh=zun0gG8f7XId1Idl6FRio3cy76k8PfGV/AV0jKqudLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Qd2xHH2V0xg3lc5vFavwzqfehMo8KT9/pNWBH0OIbh2cRCTQ05Y5wp4aC0wFdxkSq 8uYxAZFkyqjSfCrzk0Q8YpQ2T7we4jq2mjbZ7wf3zTeS/9bbQlgLljnwGhSRe13h12 ZaDcYr63AO+MmelnMuP9kqhPopBv6TekPI9sJaqA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729752AbgAVJc5 (ORCPT ); Wed, 22 Jan 2020 04:32:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:46172 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730261AbgAVJcz (ORCPT ); Wed, 22 Jan 2020 04:32:55 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5ACBA24672; Wed, 22 Jan 2020 09:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579685574; bh=zun0gG8f7XId1Idl6FRio3cy76k8PfGV/AV0jKqudLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zaz3JSL9t/9fcHkGV0zihQvjHgPEKM6BIiwA/CGSz8gy5GjWNE+ZcHwF0sCwAjDgx BB1Pu37cHxYmcmwiHPNUVDe8CfOC4LnB2ib9FnpPHPj6SM+dKZpmmb9iynZ7HBjp9w OenHMF70rN52pI67zDSHNitBrIBthnVMsgnxzEro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Kalle Valo Subject: [PATCH 4.4 68/76] cw1200: Fix a signedness bug in cw1200_load_firmware() Date: Wed, 22 Jan 2020 10:29:24 +0100 Message-Id: <20200122092801.757074212@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092751.587775548@linuxfoundation.org> References: <20200122092751.587775548@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dan Carpenter commit 4a50d454502f1401171ff061a5424583f91266db upstream. The "priv->hw_type" is an enum and in this context GCC will treat it as an unsigned int so the error handling will never trigger. Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/cw1200/fwio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/net/wireless/cw1200/fwio.c +++ b/drivers/net/wireless/cw1200/fwio.c @@ -323,12 +323,12 @@ int cw1200_load_firmware(struct cw1200_c goto out; } - priv->hw_type = cw1200_get_hw_type(val32, &major_revision); - if (priv->hw_type < 0) { + ret = cw1200_get_hw_type(val32, &major_revision); + if (ret < 0) { pr_err("Can't deduce hardware type.\n"); - ret = -ENOTSUPP; goto out; } + priv->hw_type = ret; /* Set DPLL Reg value, and read back to confirm writes work */ ret = cw1200_reg_write_32(priv, ST90TDS_TSET_GEN_R_W_REG_ID,