From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 223B8C072B1 for ; Thu, 30 May 2019 04:16:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EF1ED25263 for ; Thu, 30 May 2019 04:16:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559189777; bh=d4nY/VhsQDHC+8KC5BHkFPOCTt/TPbxIy52XXQEdmIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=t9LDMxrq4Rm/7hMWq3NVCQ53uiAw5AuFaNfMOb3f+T2GmkdQGZvXgjFbPqqET0fW7 hyOJ12fJPFxWNvuUBNYvyaOK40Y7TxvayeeB50CVZUL7HouQ/DfjzBKwSURp7oes8z GrsiBAcpYF8UpAAUVnI5SVmYr26hmU5wWMyjR8Zk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730375AbfE3EQM (ORCPT ); Thu, 30 May 2019 00:16:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:40294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729539AbfE3DPu (ORCPT ); Wed, 29 May 2019 23:15:50 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F264524580; Thu, 30 May 2019 03:15:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186150; bh=d4nY/VhsQDHC+8KC5BHkFPOCTt/TPbxIy52XXQEdmIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dLFOLPeU4hLUlZmFon8jubV69Gnc4BebUybhhHozC405p9HU577idGAhPYLxImtcV 7sMvoRg3B5bHklFemyj4RKE0kkxn2D/OsEljm1kbYL1TBQymU7TdkucsTrPD2HSgWs urjxQhgpsD8FBbloiSK1KexdBp0Uf0Vj0+Qyy9Jc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Thomson , Steve Twiss , Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.0 332/346] regulator: wm831x: Fix notifier mutex lock warning Date: Wed, 29 May 2019 20:06:45 -0700 Message-Id: <20190530030557.576059664@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030540.363386121@linuxfoundation.org> References: <20190530030540.363386121@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ Upstream commit 119c4f5085c45b60cb23c5595e45d06135b89518 ] The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function. Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API. Fixes: e4ee831f949a ("regulator: Add WM831x DC-DC buck convertor support") Suggested-by: Adam Thomson Signed-off-by: Steve Twiss Acked-by: Charles Keepax Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/wm831x-dcdc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index 5a5bc4bb08d26..4f5461ad7b629 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c @@ -183,9 +183,11 @@ static irqreturn_t wm831x_dcdc_uv_irq(int irq, void *data) { struct wm831x_dcdc *dcdc = data; + regulator_lock(dcdc->regulator); regulator_notifier_call_chain(dcdc->regulator, REGULATOR_EVENT_UNDER_VOLTAGE, NULL); + regulator_unlock(dcdc->regulator); return IRQ_HANDLED; } @@ -194,9 +196,11 @@ static irqreturn_t wm831x_dcdc_oc_irq(int irq, void *data) { struct wm831x_dcdc *dcdc = data; + regulator_lock(dcdc->regulator); regulator_notifier_call_chain(dcdc->regulator, REGULATOR_EVENT_OVER_CURRENT, NULL); + regulator_unlock(dcdc->regulator); return IRQ_HANDLED; } -- 2.20.1