From patchwork Tue Jan 2 17:54:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 123188 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp9237713qgn; Tue, 2 Jan 2018 09:56:41 -0800 (PST) X-Google-Smtp-Source: ACJfBotALi5TpHHo6c/KIYawGrPPqsarf5Vw9C47vdmtD01NiWqx6DjOfc1v8S5TUKLuFaUgFgiU X-Received: by 10.98.58.29 with SMTP id h29mr46259582pfa.121.1514915801307; Tue, 02 Jan 2018 09:56:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514915801; cv=none; d=google.com; s=arc-20160816; b=JAUbG6icjLIJAugoSOWlp+iYHp5aFJySiS3GGIuwx34+f2Q6V02icvDMkZKLPdIP7Z DhB+YGzAOnwBn5+AdUsEwlqOySwDaEi8J2sc8JRxgbin3GSIQrMAjo7MDqAn+RuJ8dzS M3j1uEifhhDWgmcqeWmapYde++Hi6lXg7Ovtrzdngq49oPSfrWX/8ZMPvq/1q0aj+oVp 1AjW4nxebAphdHibNA9uC6HGNvJIyj1raUxAgX6KMy2vXK1FsMwwIyicjXStbRtBqbDq k1JZUeD997y2ASmAbYbwTsg7yWJm0oS0DAL0Cm0Ifms8fQEKDxIr4+cRInxiOoGy9sCK woBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=acM6a49X/ufq6VgmqEYDHFu1Wo/+aC4BFYbsMajgfw0=; b=cm89Alz7j0da6BmWlsKOIlqs07PeVPXd74jIC92rkRt3dyKk4mTgN9U2ClhY554wo3 8abCxKSRfImaarDAx91dI11hNWy2uJxEsWS7ZhquSGENMO8Oyi3NWOs7CtCkyXIVmCrm 1qpqu53U0GwO2cnaeR/D+9PIAWIILVcdP1PonRq2rNQ6c6J03zCyQw0YeIR3PLPLL7V7 WNyiii/mMp1wwV+uOS2hmhhSidnB475PBQPsMxF2QyxOC2/TAjRn+akt9H2ZaeoPCZZG JKlW09sapVBcmK5ksEh62Qpy+EFk5AFDzzMkLZesqMye6eDk+dj6Kv/NZkBwU3oMl+vB CspQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KgFqwuyA; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62si32235981pld.803.2018.01.02.09.56.40; Tue, 02 Jan 2018 09:56:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KgFqwuyA; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751134AbeABR4i (ORCPT + 10 others); Tue, 2 Jan 2018 12:56:38 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:44612 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751057AbeABR4g (ORCPT ); Tue, 2 Jan 2018 12:56:36 -0500 Received: by mail-wr0-f196.google.com with SMTP id l41so37063994wre.11 for ; Tue, 02 Jan 2018 09:56:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sKlhMjDzs4N2csI+KGuCDW5B1dAwu/JkQUIODTWHpAs=; b=KgFqwuyACpprtqBg4NktoA6w/WxvifRCxV0KXg0Mv6VZ0GA3p4sXysBbF4Jez9i6D8 LU0xazCrWeqIa9S1K3doJISAyXKvM7q583bKc+TKvoxGK4za5kI9hhRCUyjpWXY2Fk5O QCbWQjhebMtsL5+h2r8vszOZpstXqlVYKMfGw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sKlhMjDzs4N2csI+KGuCDW5B1dAwu/JkQUIODTWHpAs=; b=OUI5HuLkqJvp4/WQ2dQYMtVeFhGytR4ZAxWLA7K0dv06lJKSRGqopdDIKklZzdIzuJ HEbMlpn1+jNTjexmzyLORQi3WKe1W3l3NIRXHaWCinI6YO+obXkNYVl9TPS/VDEuijcx o421/ioCijA5LXdrNErHYPQazuiwm8IHmi6LWgvz6pVa/dmKqgmBgbNijlECYrMWOmY9 luV3c1++BPytje3w94MF842M52k+EYIafA0k9EsCMSrwha2tnhyxeWwC2Ori3yR/No6t 5ZB5FTz9I2l3JFhGteMJHlx1FQ6/OAycWFSqAnvXtPyiQ/37jPwQV883KTkCQPFQZfy2 Wzyg== X-Gm-Message-State: AKGB3mLFfERjRSjyvdZn3e0MF6F7AcD8ZYPisJyGwpadHGgLN0lf3XnP ws28sUkQAy+oHL/eNdUZaqZSjxGvyf4= X-Received: by 10.223.136.183 with SMTP id f52mr11685543wrf.269.1514915795565; Tue, 02 Jan 2018 09:56:35 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id u54sm21895240wrf.77.2018.01.02.09.56.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Jan 2018 09:56:35 -0800 (PST) From: srinivas.kandagatla@linaro.org To: Greg Kroah-Hartman Cc: sdharia@codeaurora.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Colin Ian King , Srinivas Kandagatla Subject: [PATCH 2/6] slimbus: fix retries comparison to correctly identify failed allocation Date: Tue, 2 Jan 2018 17:54:20 +0000 Message-Id: <20180102175424.14391-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20180102175424.14391-1-srinivas.kandagatla@linaro.org> References: <20180102175424.14391-1-srinivas.kandagatla@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Colin Ian King Currently the check for too many retries fails because retries is actually -1 when the retry loop terminates if no pbuf can be allocated because of the post decrement on retries. Fix this by not comparing retries with zero but instead check if it is negative. Detected by CoverityScan, CID#1463143 ("Logically dead code") and CID#1463144 ("Dereference after null check") Signed-off-by: Colin Ian King Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/qcom-ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.15.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c index fb1a5e0eb8dd..2d67419a3c37 100644 --- a/drivers/slimbus/qcom-ctrl.c +++ b/drivers/slimbus/qcom-ctrl.c @@ -345,7 +345,7 @@ static int qcom_xfer_msg(struct slim_controller *sctrl, } } - if (!retries && !pbuf) + if (retries < 0 && !pbuf) return -ENOMEM; puc = (u8 *)pbuf;