From patchwork Fri Aug 6 09:16:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 492819 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp123208jap; Fri, 6 Aug 2021 02:16:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydNDlPBfuxDki3Uz59u2PFRrBWfwYu0pZPI046cYzoMK9iXD8SbqhnFs3V7Xptdkb7wN4d X-Received: by 2002:a05:6e02:e0c:: with SMTP id a12mr385798ilk.179.1628241411448; Fri, 06 Aug 2021 02:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628241411; cv=none; d=google.com; s=arc-20160816; b=Gy2FFXfXPfYcj0GfGjLbXed6TSv6CsZpgQUtrGXej6pATxWQNjgnaZbwtNY0qX6pUZ O8SxpNIYpYBVRIC2wEzE+CKoHRw6D9ofSE9A/60qVth0qp5mglFI9IusJYLGUcD5IYzl RHf+fhk4BWmrq6PeY54usSuScRmGs9/ENJAzu/7+qtgtvUSLguO3h7moDArt4F095ID2 WvInRlCnTMQPhU3sn2uuAUqMRqb2I40YNGDqNQhXJ5C9bDH/rR8DKHDPfnZhvM6WLpZm iW+cpQ4GoQdLaM/g4U23jwyZyV6n8AB2B3yHGM2PWzRXx4oBHY2mgsrcUiW7wY0GlK2X 8QmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yiquJn/INQmy4EXg5mRduxYtbDZF0r2NCJii+WrbH0Y=; b=xe6A5wZPGBX+yc3tfy02kq5uYxx+OxRRYgjG1oOw290u4fyL1IZZLn7EoYrRobkNED pIj6COS/qbPUE0YmG48YQEm/a7XgKLAMzwwpdpc1qFoCnYtJ2d40Zolltx7nqlx5ilwa KFGTFQK77wrKJJSmUGIt+VtS7rLgZOI21t0bRGEcgR/XM92QeUT14ElTfUo8PTSEZ0DP TbptoNE+aYucYJwbpu57BHPiOuOx9mKockBAQJgWhfB0G5ZWMshRNkVczvJ/0+GmkQiW tr+W3I8nYZ8BBm15LkahAD5qrE7UioCLQDN1lKWWB91HreOBy62aXm9c7SMTMs5uTNMx /DJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CTsTQ5Cd; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 h17si8426949jav.110.2021.08.06.02.16.51; Fri, 06 Aug 2021 02:16:51 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=CTsTQ5Cd; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S244397AbhHFJRE (ORCPT + 12 others); Fri, 6 Aug 2021 05:17:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244284AbhHFJRE (ORCPT ); Fri, 6 Aug 2021 05:17:04 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94A4AC06179A for ; Fri, 6 Aug 2021 02:16:48 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id b13so10198454wrs.3 for ; Fri, 06 Aug 2021 02:16:48 -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=yiquJn/INQmy4EXg5mRduxYtbDZF0r2NCJii+WrbH0Y=; b=CTsTQ5CdR0fxHvvCIoS9tNDA0sUK84/WUyUlnqDsq8r5oi/5Lmtqvy6WOoe1PnqaTs SPpc51eVB3nsqE69kNwJq+4XOyLSiwF3cQhZwLZFYqTviCPGIU+zRiRdrJAl6ASz1Hpl 2s48XrQvUirUV+y0yhnA8yqPflmipPsr3DQRxk5dCtPLFqmujhLWoE4V7RETLpfVkTSH Vqqwc/Ftv8aH4tb9rZwo/X6V7lesM+XgO828GL28gOlfPMnq8yPuF7RFZlTFD9B/J3ts uB3gsZuipYzN+bDmHUBF5E8qdnkYwx7t7YmSp67ddwL3GhMkF6H9qXM5kpXJVzqEIUnq 9aIw== 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=yiquJn/INQmy4EXg5mRduxYtbDZF0r2NCJii+WrbH0Y=; b=CUZ0FsQptbcTmiGOQExIFBtNmct+UCtFSRZUY35o1c7Hx6pohXsaHauHHzQbdTKjzi RyCyxJEuz69tfS4Ton+25av65Y3eoxLfJX/BYS0rDAoiZkrz2UJQjPt8ZQziGHJOMn2F p3jxi6FJsDHJ3NC2SLsni/Yf0VK6OxR5tieOCdaFldXPk51gTV5oR0lQVf07s8ORyZyd Xzu27bo2tANqNKX8vGSpxouUIpbrqXYmhVlqT8OXCmHPzrs1ISOLQ9M9NY2yb63y9WNk S18zKgXJ9V3AdXIkaJebAbCKSPssnqUJEkqbvLRKddHg74dUIfBtQsGeDPFe+i4Dae1J MAHA== X-Gm-Message-State: AOAM531azbfivtOQ860T50aSC1N8JnYiI8mbLDQp59/4qawLsXWQ5DQl lcjdMoDyOldKxRM7dO+GRl0ZvA== X-Received: by 2002:a5d:4dc7:: with SMTP id f7mr9899726wru.118.1628241407222; Fri, 06 Aug 2021 02:16:47 -0700 (PDT) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id w3sm7811760wmi.44.2021.08.06.02.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Aug 2021 02:16:46 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Srinivas Kandagatla , stable@vger.kernel.org Subject: [PATCH 2/4] slimbus: messaging: check for valid transaction id Date: Fri, 6 Aug 2021 10:16:37 +0100 Message-Id: <20210806091639.532-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210806091639.532-1-srinivas.kandagatla@linaro.org> References: <20210806091639.532-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org In some usecases transaction ids are dynamically allocated inside the controller driver after sending the messages which have generic acknowledge responses. So check for this before refcounting pm_runtime. Without this we would end up imbalancing runtime pm count by doing pm_runtime_put() in both slim_do_transfer() and slim_msg_response() for a single pm_runtime_get() in slim_do_transfer() Fixes: d3062a210930 ("slimbus: messaging: add slim_alloc/free_txn_tid()") Cc: Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/messaging.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.21.0 diff --git a/drivers/slimbus/messaging.c b/drivers/slimbus/messaging.c index 6097ddc43a35..e5ae26227bdb 100644 --- a/drivers/slimbus/messaging.c +++ b/drivers/slimbus/messaging.c @@ -131,7 +131,8 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn) goto slim_xfer_err; } } - + /* Initialize tid to invalid value */ + txn->tid = 0; need_tid = slim_tid_txn(txn->mt, txn->mc); if (need_tid) { @@ -163,7 +164,7 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn) txn->mt, txn->mc, txn->la, ret); slim_xfer_err: - if (!clk_pause_msg && (!need_tid || ret == -ETIMEDOUT)) { + if (!clk_pause_msg && (txn->tid == 0 || ret == -ETIMEDOUT)) { /* * remove runtime-pm vote if this was TX only, or * if there was error during this transaction