Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2902286pxb; Tue, 24 Aug 2021 10:13:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzJRTLTJDx0HsjSODYKeADXIQgUWVOsnU8kIOL8wrELDBmbWVktG5ALE6n4xbLaUzXQT/C X-Received: by 2002:a92:d10d:: with SMTP id a13mr28488784ilb.87.1629825183723; Tue, 24 Aug 2021 10:13:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629825183; cv=none; d=google.com; s=arc-20160816; b=dBhMq9gMCTpcDVGYqoOqqVJFmEAlDwHoDZnhbcnItjcvxfz0KLGaoOoaLLl97qRPgQ QTb7mJisoCbtNUla3l6obltEqyIQxk3jqqlSVGKwa+gxUeIa9zuH7lZ/0MZ3w5gMY5ai QBsycH97GwyRmMrReUkF5apeOesNKQXasOmYazBUbEoISbPXMhCLP7qxUF0r0eqysula rxb/Ej34k5Pslwt8N5cppWLMoCUXhkIgDQJ+GwMwJmidbVhe8tZpHLp9AEXRUHvNdFME 7zu5ev1wL6GvGaG1LxB0Ct8ROG7fvcRY94RLmeXROdnmMJQrUkED8sblSDssheTAxKoh tSew== 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=gB5d3PW1pINJf7flhCqySSH2qq5Fhr5aPTctgJDJxgQ=; b=eL4u+seBKW7DlVRQcYx+T8kM3YyBrPZhkC6SPH1cMYPs06wVp9goeUPnKtU7V/EvYw buMiL9XVdRR26Nc3CaalWiaUyHxo4oWFHCcTxfTwtdzmIY6jdV/CL06Btc3JIG0an7sh Jg24Z945XfgiERw5SoK3TXZowz9iE3ij0BPGB+zoG1eqtfhjsB4hJp1G3wygamGIzoLv 2OenkaxOKPYI9kdoKt815LqVjfku1VSPNNf9BZ/i0lU5Z2P4rBtl2JweAt2hTM2p1OOF KC9K6X6cuDdGzXEVT0lsUHLvNKVZcoTdX2k8OkdysFwhxAxugkcOyiY+uWH1nRq8yCiV MbhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JOaQ5llh; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si23964058jat.85.2021.08.24.10.12.52; Tue, 24 Aug 2021 10:13:03 -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=@kernel.org header.s=k20201202 header.b=JOaQ5llh; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239811AbhHXRMt (ORCPT + 99 others); Tue, 24 Aug 2021 13:12:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:51854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240108AbhHXRKD (ORCPT ); Tue, 24 Aug 2021 13:10:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0128A619EB; Tue, 24 Aug 2021 17:00:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824430; bh=JlAChC0NDvnHCGqHRCn5zrNe29Lr+0u/OSXqd75o3sA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JOaQ5llhUj/OkaQLywTMccG2E4nDOogKfaONvcFtXtZLZxynR6oWo3k9T7WL3eWC7 9JgiwaiYH5lH0bTbCy7vod4cu9KUzzcVWaJsWZhxbPaMG6kTxlvWkbZQ5HurSl+5pX 8gn7hmCZAZsnVNzMNao4UZN14FRY53/KSIbxeKdgSJs6lJqxZ50Vh+dXm66PMBX/Vf Ke8Uy7GhHxlVghX4hBaIdj11psAdBRmas2ISJ/y3fQCVLbqe5GB1NRMeAePuJZ0nOg yWYpXk1pHzt33VHWnnoQwjNYjyQv+Z2D2BvFmUjoZ4Z1sYfQqU4+yS2hIiY9C6VQg+ dVQrXuq7ShQAQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Srinivas Kandagatla , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 5.10 81/98] slimbus: messaging: check for valid transaction id Date: Tue, 24 Aug 2021 12:58:51 -0400 Message-Id: <20210824165908.709932-82-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165908.709932-1-sashal@kernel.org> References: <20210824165908.709932-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.61-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.10.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.10.61-rc1 X-KernelTest-Deadline: 2021-08-26T16:58+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinivas Kandagatla [ Upstream commit a263c1ff6abe0e66712f40d595bbddc7a35907f8 ] 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 Link: https://lore.kernel.org/r/20210809082428.11236-3-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/slimbus/messaging.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/slimbus/messaging.c b/drivers/slimbus/messaging.c index 3b77713f1e3f..ddf0371ad52b 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 -- 2.30.2