Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp697995ybz; Wed, 15 Apr 2020 16:59:32 -0700 (PDT) X-Google-Smtp-Source: APiQypIpaxe7povalEj3Q758TxSmgPx/8+7kma/UqttxrZax1Y/ibP1LmdfVzX7xHjsR/7vdfBlI X-Received: by 2002:a17:906:1f47:: with SMTP id d7mr7445754ejk.37.1586995172116; Wed, 15 Apr 2020 16:59:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586995172; cv=none; d=google.com; s=arc-20160816; b=hZisyZm02+1jIQxkbq95gAUx+1TPAQ5emjK8+yGyelI0n2UCGN05dvakIwMn8vuCWt ttFIS6mGikfSPkX92q7pa18MTo4VtOTvhXN2k7u5cNRpmH0D+4hQnG4TX/QcB9+bVNw7 xzb1hvi962Gt5BnnyLpf8jXscwuo/ggmGUQL3YnhlRpIjdRIFFw4FUK44g6z1s6vGp8l YkiqD0b+pggOMgN2Lm5R+45FV+xYKlYVrn8IdD8L9rbOXGq8awYDpNpOsxlC3z1I0Bs4 PLUjCJRsJUYhRKQOKJTCDeuVsIOS2qE5U2K6SkSbgGYMGfpYTdJSeYeHAfbdJPr4VXmd TcPA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5U+39TkWTU7CFl4lHYQgx2px7qcje/SDjhq9vzEPb9I=; b=rtrA+w4ad0SeMMzklAQ4UQqpE+qZs8rHFBdoeK4w5YMVljj8UdoP6FMV1eITRn8G2B /inO1yMZsdTnZqjsaiBTnKOSwb4LGUM1l5gQ0tltcKDOnribIWRmRbeKZ6x1FHAYKTI4 NG9F6RvAY9eC+8853vkyN7e8hCUJGHJp/AZu/mfT+c/F3Csuy5/jCanMIAHqpND/FThN el6iM3wbyAec9RZnYCRs9pxgNiV293hwNkZvHRYAaoBKOJOK6WYrYvZPnr95RAT3rfEN X/FQxLfbnZPgmVVVw5JCyypgsDwS583taR84E+iD/hRlcJiSMa7+TA+YqeHsB/35lKep W4bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N2rVIq8S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w9si11257538ejv.285.2020.04.15.16.59.08; Wed, 15 Apr 2020 16:59:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N2rVIq8S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505808AbgDONDy (ORCPT + 99 others); Wed, 15 Apr 2020 09:03:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2505787AbgDONDd (ORCPT ); Wed, 15 Apr 2020 09:03:33 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EFC2C061A10 for ; Wed, 15 Apr 2020 06:03:32 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id i10so19042808wrv.10 for ; Wed, 15 Apr 2020 06:03:32 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=5U+39TkWTU7CFl4lHYQgx2px7qcje/SDjhq9vzEPb9I=; b=N2rVIq8SiMSbzTNB44TC26fvAv9RrVWuy6i9RVjT2e9/6PysXAY3o0cw+pGWROjdBT QzuYNOW1ybVUXDbym1nHs7jnZmEcj9yMQl4lwcgD+2XpMj5fXKtoLOKFKRw8n/EbE2t9 zWCC/2VMGbjJVcpWrjBUuOv9XEbVmwh37j3cge2Q68HSm6QnoKltgmB9pLuV69f/dohi +pU4kIIppcHgsVJrbc6nBBCVDeDW/19FPeZN1sQ28ssPgkfHKjNwZK5O7MwKgUuMUtXL 5lHxtBevxCIy6Fk1UmvPiHRlkopVWcxnYeqjodhYb5FIocFN1RbPnlHNxjDxi2pUp1jL FSwg== 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:mime-version:content-transfer-encoding; bh=5U+39TkWTU7CFl4lHYQgx2px7qcje/SDjhq9vzEPb9I=; b=Bx78FN5/yuOcsdAb7kOvI1Hgbf0uHQN+iKLQSwxCQyvOVE/EOmpPgj1itDk0PLGBL8 k87trQViYHa+BUcL8m4OFL5dyKTbzCQJ9uJyBqkXd4n6j4ewFzh1SB/2lgWYXpZHgr1E VKtFR8sQSGvQyYXbpSaiX3ypCVslgB9G3xYM2aDIln0zNfpZEL/UNmdMjnjBNvO2Onn2 mJI7z47XqnA8Mo8RaQbagXxO5UKDFEX1Njz9w6DjG+m01RAJowjfZzs/5Mbg/WH0EGO+ +/y+PlIj9udsdoDYZiM74qYI8qkGi8QE1NbKk/HbVt6AXKxnLAPWM9+UqfSNn8/CZ2Mv Dx4A== X-Gm-Message-State: AGi0PuZqKnd3LkB67lAMr7BWi4vhC1yKo5zmbZFtg9ttnI0uuDbv2mbP TP/bPRMxqaH4SsLpXxX7/tHr6A== X-Received: by 2002:adf:f282:: with SMTP id k2mr11397809wro.133.1586955811195; Wed, 15 Apr 2020 06:03:31 -0700 (PDT) Received: from localhost.localdomain ([87.120.218.65]) by smtp.googlemail.com with ESMTPSA id b66sm23418111wmh.12.2020.04.15.06.03.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Apr 2020 06:03:30 -0700 (PDT) From: Georgi Djakov To: gregkh@linuxfoundation.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH 1/1] interconnect: qcom: Fix uninitialized tcs_cmd::wait Date: Wed, 15 Apr 2020 16:03:27 +0300 Message-Id: <20200415130327.23059-2-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200415130327.23059-1-georgi.djakov@linaro.org> References: <20200415130327.23059-1-georgi.djakov@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Tipton Currently, if tcs_cmd_gen is called with commit=false, then tcs_cmd::wait is left uninitialized. Since the tcs_cmd structures passed to this function aren't zero-initialized, then we're left with random wait values. This results in waiting for completion for more commands than is necessary, depending on what's on the stack at the time. Removing the unnecessary if-condition fixes this, but add an explicit memset of the tcs_cmd structure as well to ensure predictable behavior if more tcs_cmd members are added in the future. Fixes: 976daac4a1c5 ("interconnect: qcom: Consolidate interconnect RPMh support") Signed-off-by: Mike Tipton Reviewed-by: Bjorn Andersson Link: https://lore.kernel.org/r/20200319231021.18108-1-mdtipton@codeaurora.org Signed-off-by: Georgi Djakov --- drivers/interconnect/qcom/bcm-voter.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c index 2adfde8cdf19..2a11a63e7217 100644 --- a/drivers/interconnect/qcom/bcm-voter.c +++ b/drivers/interconnect/qcom/bcm-voter.c @@ -96,6 +96,8 @@ static inline void tcs_cmd_gen(struct tcs_cmd *cmd, u64 vote_x, u64 vote_y, if (!cmd) return; + memset(cmd, 0, sizeof(*cmd)); + if (vote_x == 0 && vote_y == 0) valid = false; @@ -112,8 +114,7 @@ static inline void tcs_cmd_gen(struct tcs_cmd *cmd, u64 vote_x, u64 vote_y, * Set the wait for completion flag on command that need to be completed * before the next command. */ - if (commit) - cmd->wait = true; + cmd->wait = commit; } static void tcs_list_gen(struct list_head *bcm_list, int bucket,