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,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 F13CEC072B1 for ; Thu, 30 May 2019 04:37:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C72B12587E for ; Thu, 30 May 2019 04:37:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559191027; bh=LGWTRqgfYW/xkeHNJhr1bcN3eshbTj/EqbogxacKHOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lv9fjNyhRNU3ErfXgqE6Q7PlYMcxAyGBMnoxHpVqSXToUvjVSN41/VB0r+30D90Xi zbFNLOSPzjJxljM5gHpue+7I/W3qZQzdA77cQhlkuGYREqkldnvIMi0nZL3M73PbH7 rC9oHnMrj1CSlNmSM7e2ECzaXhVtHJxMtsmTEPUk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729894AbfE3EhG (ORCPT ); Thu, 30 May 2019 00:37:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:56804 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727834AbfE3DMz (ORCPT ); Wed, 29 May 2019 23:12:55 -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 5253F2449A; Thu, 30 May 2019 03:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559185975; bh=LGWTRqgfYW/xkeHNJhr1bcN3eshbTj/EqbogxacKHOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h+WhtiQ9j+yELZY0wV6oKbp+7ZLhuVV+xqVhmAQkTUYS5TzU6VQndjczjU5CIAIVc pZW7HJq2YEF2ABHunVeEKR+PTMIOhtEk5YoNfYCcio1VcMwtBL7XIugtnn3uM8sK7h KO3Niu44uW5ZP68apc0FYkDOfEcDtPtwfcqKaIGM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Thomson , Steve Twiss , Mark Brown , Sasha Levin Subject: [PATCH 5.1 388/405] regulator: pv88090: Fix notifier mutex lock warning Date: Wed, 29 May 2019 20:06:26 -0700 Message-Id: <20190530030600.295255384@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030540.291644921@linuxfoundation.org> References: <20190530030540.291644921@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 275513b7695a61b75b2546406ecd0f8e3d9fc8be ] 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: c90456e36d9c ("regulator: pv88090: new regulator driver") Suggested-by: Adam Thomson Signed-off-by: Steve Twiss Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/pv88090-regulator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/regulator/pv88090-regulator.c b/drivers/regulator/pv88090-regulator.c index 6e97cc6df2eec..90f4f907fb3fb 100644 --- a/drivers/regulator/pv88090-regulator.c +++ b/drivers/regulator/pv88090-regulator.c @@ -237,9 +237,11 @@ static irqreturn_t pv88090_irq_handler(int irq, void *data) if (reg_val & PV88090_E_VDD_FLT) { for (i = 0; i < PV88090_MAX_REGULATORS; i++) { if (chip->rdev[i] != NULL) { + regulator_lock(chip->rdev[i]); regulator_notifier_call_chain(chip->rdev[i], REGULATOR_EVENT_UNDER_VOLTAGE, NULL); + regulator_unlock(chip->rdev[i]); } } @@ -254,9 +256,11 @@ static irqreturn_t pv88090_irq_handler(int irq, void *data) if (reg_val & PV88090_E_OVER_TEMP) { for (i = 0; i < PV88090_MAX_REGULATORS; i++) { if (chip->rdev[i] != NULL) { + regulator_lock(chip->rdev[i]); regulator_notifier_call_chain(chip->rdev[i], REGULATOR_EVENT_OVER_TEMP, NULL); + regulator_unlock(chip->rdev[i]); } } -- 2.20.1