Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1839678pxb; Mon, 13 Sep 2021 06:41:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0yLffIISy+Zp0iusoSb8IsyxS6B6/Qho9JihMFOHutCOdEtXLSQZ3UImvqVadlYTEoa1N X-Received: by 2002:a05:6e02:2163:: with SMTP id s3mr8478489ilv.172.1631540504000; Mon, 13 Sep 2021 06:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631540503; cv=none; d=google.com; s=arc-20160816; b=bvUNULSVLZ9nTvIQ/73hr71kyYJdoHyC3Yq7ggFn3xxf/2zm3gIA1q0XXC6fQG4guA ZSIestwYp3uLQ7ir3zTNL4W7059GIHkybBFJ303WeqvKSxB2e7j1PePLLg12Zi4H3eS8 y5gHg5WTyDxyLWG3ZJXyYSGWj/LUrKfkXK2fXy8HQ7uq16CrU04JKHPxjpIpWTJOdP4+ RwlXFNWilnRO01EKMjnZIYmRgtPCEHW7yW/uNi6os+pFtZxj2ZT8KgX9AEz6IsJnFiId Qppf/r9ubHpOZpdlZwtGdr72SRs4bxVGFUZTHQOzThASnDYluycj+TUnIzitgabElvw/ CGsQ== 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=VaICaBJRW/0PZvGD/p8fhvH4bQLm5aL5D2yO2OicCwcxLd8eLjMVwl18DUk45jDw9r wTTIMVBr01A3qrTczA5NR/JXnQSXf85eDw9F2AN0CTWiWyw6MPEI6NbU9KdWvMZ8s0CO ESbLcOvs/54PNZ/+tQdTTVidTdeP0oflpzTgynRS+2JvPD2MTwaIrkW/sH5v+03Uwzuv eJ7jbUK3q5CmuLO9FlpALyt/iNLs5KV20WYdWzMlDT6v66NzKXMQszE36+EpSd4a+IUT GIrjlz1AuCsKYx4rS4SkE/Yo+qwZ7wJhsWR7wbxzlHJLWpRQjt8CDw15OaOUPjgxfc5T N3IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yyWzJ5om; 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 f46si6566974jaa.87.2021.09.13.06.41.32; Mon, 13 Sep 2021 06:41:43 -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=yyWzJ5om; 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 S243798AbhIMNkE (ORCPT + 99 others); Mon, 13 Sep 2021 09:40:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:58462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242977AbhIMNeh (ORCPT ); Mon, 13 Sep 2021 09:34:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 03C7B6113E; Mon, 13 Sep 2021 13:26:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539612; bh=6WR/PA9doHS9lRfGDEn/9vjBBD+HOGYCtRs8PzhaRh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yyWzJ5omfayvkqYW5LqlM5O6mgcaJgn2CZlWh/Wm41YkHOCMwu/gzdqh4IcxEX+yM 6icnQNvW+pCRFz8xHZtjHCxCNwfVkmFZHf5mhdfKWlcOx4dS5Sf/FG6PuCamswQ76a TXkfrRbOnQKcuZLKBEG6pgaq8PTt5cylGk9DcdGE= 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.10 064/236] regulator: vctrl: Use locked regulator_get_voltage in probe path Date: Mon, 13 Sep 2021 15:12:49 +0200 Message-Id: <20210913131102.541106084@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@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