Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp136932pxb; Mon, 13 Sep 2021 15:11:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVfUeElIz4PXgkDeFw03ybLpk2RNSS8osTqVZQA7pLvUjrBxLTHvGVek79/pnDChPZPkex X-Received: by 2002:a5e:8e4c:: with SMTP id r12mr11144445ioo.73.1631571081455; Mon, 13 Sep 2021 15:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631571081; cv=none; d=google.com; s=arc-20160816; b=CE9631SIo+xpUl40M4XZ9zOJk1Wg03Na+Skz9jnk8w06Z0w3WYa4NVRQorQV4fKWnA OMN99T74fidr4juVj+oOkfi1Uc+YzyMJsDrIhTZisYRU27TqTKUv1VmeCw/yueD+gvQJ s3kizmshSYjRcI4ZSCDMdPCEiJ2smyXSfqVNk+5amLUIqIgIYA8MhNVi1j9bvBfpVGF7 8BTcC8kPIxpfyfdwg0g4V5SV5jKBY/CskRDcUemInCKgmrnlTd104i5y2M6zUL/bAMpF DisOFDhatV0iLl/NDgtRMQufnCDjg+NFVVEH+pjuyJZzTFYfiqLoA73ES19lS/pPB9Tq fjpA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b0uUsRiCosDZDL+aNoyqDO07yrDsiXXFYL4gz4d15vA=; b=BrbQa0q4OxJqvfsF8LVPlNN9F02x7zQmYNrz7KUpe/IHVrzuGvO6GZW4ddZoMEbeAV dAvFFeiUkDR4ca1JsuIyp9Zloe4mllCqTixc6YzfcMZN974V2pE+qeccUac3yWApoO75 u38pJs7Un90KoXo6nhTzCc34jeN9BLbD+q1B7UljQXthDPMqJqnYGljfivlf7PLn8JMs y3jap6CkTPocVL+Ec9bZYnxJ5mVzAuUHuz9idGKlNNdiOyQCuGwO/LaMQ6uNJfHNJCZp QmWxk0bfEjfLrg295szriPqT0UhG1UONymZG9rlLs0uv5k886ts4LeTmkBQUglsbRPIr BSYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CeDuU+q0; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m12si5481312iov.37.2021.09.13.15.11.09; Mon, 13 Sep 2021 15:11:21 -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=@linuxfoundation.org header.s=korg header.b=CeDuU+q0; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245061AbhIMN7A (ORCPT + 99 others); Mon, 13 Sep 2021 09:59:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:46012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245575AbhIMN4g (ORCPT ); Mon, 13 Sep 2021 09:56:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 79F20619E2; Mon, 13 Sep 2021 13:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631540157; bh=6WR/PA9doHS9lRfGDEn/9vjBBD+HOGYCtRs8PzhaRh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CeDuU+q0BmHF+wHRuN6rpiACpnNXx9OAmb0MLVwIihLeXYsfN1L7/M7eEkG3ynk5R 9ybHcesYvCk//uhzRD8J4GfIWLYV/Bt6soFAuss0l44yPGR6QG8hfEbtu8Yi1bCJtD ePNbamMyLAAZv9RAW9iP3T+q8qKl+dRTG6KvW0hU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Mark Brown , Sasha Levin Subject: [PATCH 5.13 075/300] regulator: vctrl: Use locked regulator_get_voltage in probe path Date: Mon, 13 Sep 2021 15:12:16 +0200 Message-Id: <20210913131111.884228452@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131109.253835823@linuxfoundation.org> References: <20210913131109.253835823@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen-Yu Tsai [ Upstream commit 98e47570ba985f2310586c80409238200fa3170f ] In commit e9153311491d ("regulator: vctrl-regulator: Avoid deadlock getting and setting the voltage"), all calls to get/set the voltage of the control regulator were switched to unlocked versions to avoid deadlocks. However, the call in the probe path is done without regulator locks held. In this case the locked version should be used. Switch back to the locked regulator_get_voltage() in the probe path to avoid any mishaps. Fixes: e9153311491d ("regulator: vctrl-regulator: Avoid deadlock getting and setting the voltage") Signed-off-by: Chen-Yu Tsai Link: https://lore.kernel.org/r/20210825033704.3307263-2-wenst@chromium.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/vctrl-regulator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/vctrl-regulator.c b/drivers/regulator/vctrl-regulator.c index cbadb1c99679..93d33201ffe0 100644 --- a/drivers/regulator/vctrl-regulator.c +++ b/drivers/regulator/vctrl-regulator.c @@ -490,7 +490,8 @@ static int vctrl_probe(struct platform_device *pdev) if (ret) return ret; - ctrl_uV = regulator_get_voltage_rdev(vctrl->ctrl_reg->rdev); + /* Use locked consumer API when not in regulator framework */ + ctrl_uV = regulator_get_voltage(vctrl->ctrl_reg); if (ctrl_uV < 0) { dev_err(&pdev->dev, "failed to get control voltage\n"); return ctrl_uV; -- 2.30.2