Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1826613pxb; Mon, 13 Sep 2021 06:25:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzLFhvneclvnx+mXQFKAxwU3CYLaJjrkKaE3N9FFUSX9ygsyMcm6lSVJeucK4dP8uRUAUD X-Received: by 2002:a05:6638:399:: with SMTP id y25mr9684935jap.23.1631539550092; Mon, 13 Sep 2021 06:25:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631539550; cv=none; d=google.com; s=arc-20160816; b=KXpjlAjDLs7Y/Pq8oYZRlOfi9/XT/jzgGnHTi4xvvMgrgoq7LDKOjH++NOU4qgpvwS 2GbKxXT6IANFzWcG5cAmCCgLzXkPZ5VtKh2KwwXRyO3j+43sV6t/5t8nTR8e7euaOoHc CwTZLXosKZe+lxau/SINm7uTlsuziwwJMdSXmDyRzaRLxsOrIaM7mrfRPT8Y8zJiW3vs ywAtFpWmFqvRCsd8f0ToO9YknYmejrfXIGIT5ogE2pGmmfhTLQ5CJ/yx1T3taCIVnGJU iPkmJt8pnremBH7HMrjKwAf7gyUNyhNNWmT+CJg+ppVjvBSy34HB6Rg0MC76vOcwBA6k eYfg== 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=KzUeMc8qy1/MNgiEYqs2aV28bTAyKE2UVHGRsTOHxtrmFfbhs12vPX4umbUpc/xoDG sxhW+s0I0TW3A1dK8p9Th154WIldKG7ebbBkbo8depd+XCkFtCejSqTXoiHOa07P5Ec6 5Dg3oi0zpxG3WQ3WGkwLlt6U1HEY6hmClZeQy1TnCaH96o8yReoLSqAqHxWcWlVg39yN I9ZdJl+ytk5A3/X5W27Fj2yJ1VUO94fR0muzfcm7RC1rVa1QmUVZB97tiGh+ABw+ACi8 T98mUZJbBbO1VTsrjo3YysgJeZXhdFTcYBIks0seaqZl6PJYNOP+ceWlE0cOw1KkQ367 yR4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zZ6xsjVI; 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 q17si7367933ilm.90.2021.09.13.06.25.37; Mon, 13 Sep 2021 06:25:50 -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=zZ6xsjVI; 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 S241562AbhIMNYV (ORCPT + 99 others); Mon, 13 Sep 2021 09:24:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:35302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240228AbhIMNUD (ORCPT ); Mon, 13 Sep 2021 09:20:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D50556112E; Mon, 13 Sep 2021 13:18:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539098; bh=6WR/PA9doHS9lRfGDEn/9vjBBD+HOGYCtRs8PzhaRh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zZ6xsjVIfIXDjfIQTvt0vqWtj3UMM6xdpBJRZ+q6wB6SbuFyNxq5K/V2yXfAvvv2T x6KDp/aJaPTHMFh5t+Wc3bzidxIVkObbQe+sS0TI8VgI0GE1+CYsyvWno0NZp1Vr1h RRq8PE+MPYl5tMj0aPhWt/qEfai49TBkhyepF0vQ= 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.4 041/144] regulator: vctrl: Use locked regulator_get_voltage in probe path Date: Mon, 13 Sep 2021 15:13:42 +0200 Message-Id: <20210913131049.319371559@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131047.974309396@linuxfoundation.org> References: <20210913131047.974309396@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