Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2454428imd; Fri, 2 Nov 2018 11:41:00 -0700 (PDT) X-Google-Smtp-Source: AJdET5fnsOq8+Ab6uIy0ZiGC5ZapNsjB1evmAUmti3XomeHbbc/Ur/iFEW8CvYAsMNYM24fkpZYK X-Received: by 2002:a63:2c0e:: with SMTP id s14-v6mr11792309pgs.70.1541184060839; Fri, 02 Nov 2018 11:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184060; cv=none; d=google.com; s=arc-20160816; b=i6Co1cq2vUvtzJIHBAeSkMFdkird3/kX3+EWXXFmR6cQI3Dovx4gtgwLeWtapmPb20 hYqTtKwlqE4vjACZpF95aKLdChVlv0j/513v8ZqaqiYCe6xtr6aurZLRoRYi7tYHn6iP 86LPfkzdoJecg+Pj/wLOVzTlr/0OhSS6NiPzEtDiv8efRvfQEjuVT0kyX6QpEZMgyKZu oH746wmY/NyYyPzqcTjB3ogAqyZCEnL13i+0n26TTbxgsC6uQzHv6mMp8cejrSonAM+T pXoYP97eAvK16d3AzHVnES0Wxx0CUZUcgXFSQobI2B1X7SHGpAvB5nhsN6URymjo3fkS bb2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+pGtIYPJlRj/ZWXsFRfIfuMY6nje0AvQzIh8p3Jxa+4=; b=JiBoanUvbpu4eLFomi4HaRc602tFXW+OW69YIJstaS6ZDSPRLBIMmx/6qqKkF9Hi8B ZcptdhaZJHhQfsL/wbUx1SqOOqabG8k1sTxL43AxJ5Jrk/vEWPxNSvS89zXxNcRoB/qc +jJgojxHrqk5nANFxsfdqYF10IDMiKq4ylQSqyDZltlK/7mS4ryaeAH1sdBHyg/TNKjY pHc03ucVtyxw4AKQ8wA/td3tdbZYDEDolzoplRmNAg3V6S4uB0erRRVvgc/dz/p9uPBR w4S34Bto+BD9L8Wj2/ky5+fxu/7Mb/5NGKzGd2+JLdhVtclK1FWpGn4ddu7Gde+cIaNe O47w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HMb4nU93; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5-v6si4242613pln.42.2018.11.02.11.40.46; Fri, 02 Nov 2018 11:41:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HMb4nU93; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728816AbeKCDqb (ORCPT + 99 others); Fri, 2 Nov 2018 23:46:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:40282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727556AbeKCDqa (ORCPT ); Fri, 2 Nov 2018 23:46:30 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.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 1543C2082E; Fri, 2 Nov 2018 18:38:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541183899; bh=hIqrV87r5iPV8Y5kHBf9wrvKt4vrSQPTRzBP39xV94E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HMb4nU93kwHZqeQ5GOD9tFBS7+uG2LlGGPqwxPlyOUiD/X3pqQVEyOjV4ocH6qxGG E45rjuSWXNanktOxTV23kbfp3XpH9nPhQ66puzuK9W3/bW6M5qQyY08WgVUry1CPCN 2gXZ7Sg4sm+tfVLn9k6yXjOba8pd1oAE66Hlvq+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Russell King , Sasha Levin Subject: [PATCH 4.18 014/150] drm/i2c: tda9950: fix timeout counter check Date: Fri, 2 Nov 2018 19:32:56 +0100 Message-Id: <20181102182903.738283675@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit d98627d1360d55e3b28f702caca8b6342c4a4e45 ] Currently the check to see if the timeout has reached zero is incorrect and the check is instead checking if the timeout is non-zero and not zero, hence it will break out of the loop on the first iteration and the msleep is never executed. Fix this by breaking from the loop when timeout is zero. Detected by CoverityScan, CID#1469404 ("Logically Dead Code") Fixes: f0316f93897c ("drm/i2c: tda9950: add CEC driver") Signed-off-by: Colin Ian King Signed-off-by: Russell King Signed-off-by: Sasha Levin --- drivers/gpu/drm/i2c/tda9950.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i2c/tda9950.c b/drivers/gpu/drm/i2c/tda9950.c index 3f7396caad48..f2186409f0cf 100644 --- a/drivers/gpu/drm/i2c/tda9950.c +++ b/drivers/gpu/drm/i2c/tda9950.c @@ -307,7 +307,7 @@ static void tda9950_release(struct tda9950_priv *priv) /* Wait up to .5s for it to signal non-busy */ do { csr = tda9950_read(client, REG_CSR); - if (!(csr & CSR_BUSY) || --timeout) + if (!(csr & CSR_BUSY) || !--timeout) break; msleep(10); } while (1); -- 2.17.1