Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3547786pxj; Mon, 24 May 2021 09:07:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzurpPZpat1AxPjJl4dq76WcFXsFsJ7/OQ5xXQKf6oHVufu6mDlYkfGw5LD8MYpffwMWCl8 X-Received: by 2002:a6b:7b08:: with SMTP id l8mr15103506iop.50.1621872437163; Mon, 24 May 2021 09:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872437; cv=none; d=google.com; s=arc-20160816; b=t8zVKW+HRRJhu0H6gwonVUM5C15fXKQbYMQbexY5evtadrt4kRmTpYETOJ0Avif0O1 6kbuQnL9YFrin9+u4coPoU+OKKtBtDurH5VBD7ZZgMAknOWdkmPzQin07SdTmU1V72p9 2lfgrXvrkOkTXEetGbqjBBzOfAhiD6QHoIyA8N6X6vIp5XiXUD5rwTUsRMnYtMrE2ee6 pxVtyDRBuc8WMRuj9/JLaj9yX8z0X+UMDc/kUKce4uONbP8F10QFLGxEG7PuH30svg1t /efoxyFxY1Nv+f8ltcJtYS+XwRDiXMMbFB1UAR/85KjZxQ3zrxQSSRPeDdqB8OZjacaC yARw== 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=KGhaK4cgiGNLVpybn71Llzkl9CPhM4wB1W9pPxcyBO0=; b=YnhGB1f8jjffdqR05u19GhuJDqfIi/oMAPli5iiShvx7p+QOlaQmV9VNzsX7XfUrak vYcrBQvYxhqXQ4X2A06gZgEqfUOjPfmoSjPN3NQVtMDur49g0vlkMAS16gpZmGdc9yPD Qm0R5kkY29jmHrmRYrEPf+8YO6G1+Qr72GBNha5W1RkQfwcKm90qziezC/ha3fgCpq5r 9xbWPjlbn54Gl6LMWCskkL85M0Aq+d/P1TmDZKOMf6k9QQDnyDgYDpmggRpWZ6wlxvYl gnQ0dcp+B9gNxp0jcW2A9RHwemMycU21dv7kJql0LsPdqVbEoK8PS9PQQrhQBiirGPuk mPUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="xDN0/qK9"; 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 d8si13985466ilo.3.2021.05.24.09.07.04; Mon, 24 May 2021 09:07:17 -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="xDN0/qK9"; 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 S235935AbhEXQHB (ORCPT + 99 others); Mon, 24 May 2021 12:07:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:40466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233194AbhEXP6X (ORCPT ); Mon, 24 May 2021 11:58:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C1B1661961; Mon, 24 May 2021 15:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621871055; bh=CDRMBNjaStc0Wy7yYEz1n1EtEWzMYRWonj//RK82c3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xDN0/qK9aBnY5mP7nNHQw7tgO399fA+5gaP47sWcQ4KKvcDHWM0a5DPByH4KnMm9c qJlSU7FCmXdbY0LUN2gkDmWcodT5U15/9o5XsNDNRe1vA+h7FOtdEnD/aAa8dW8DSU 8YsfgLtvbSqubMwwN4hAZknQ0EI4eAw9ZbKFEL7I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bartosz Golaszewski , Hsin-Yi Wang Subject: [PATCH 5.12 041/127] misc: eeprom: at24: check suspend status before disable regulator Date: Mon, 24 May 2021 17:25:58 +0200 Message-Id: <20210524152336.237370210@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152334.857620285@linuxfoundation.org> References: <20210524152334.857620285@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: Hsin-Yi Wang commit 2962484dfef8dbb7f9059822bc26ce8a04d0e47c upstream. cd5676db0574 ("misc: eeprom: at24: support pm_runtime control") disables regulator in runtime suspend. If runtime suspend is called before regulator disable, it will results in regulator unbalanced disabling. Fixes: cd5676db0574 ("misc: eeprom: at24: support pm_runtime control") Cc: stable Acked-by: Bartosz Golaszewski Signed-off-by: Hsin-Yi Wang Link: https://lore.kernel.org/r/20210420133050.377209-1-hsinyi@chromium.org Signed-off-by: Greg Kroah-Hartman --- drivers/misc/eeprom/at24.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -763,7 +763,8 @@ static int at24_probe(struct i2c_client at24->nvmem = devm_nvmem_register(dev, &nvmem_config); if (IS_ERR(at24->nvmem)) { pm_runtime_disable(dev); - regulator_disable(at24->vcc_reg); + if (!pm_runtime_status_suspended(dev)) + regulator_disable(at24->vcc_reg); return PTR_ERR(at24->nvmem); } @@ -774,7 +775,8 @@ static int at24_probe(struct i2c_client err = at24_read(at24, 0, &test_byte, 1); if (err) { pm_runtime_disable(dev); - regulator_disable(at24->vcc_reg); + if (!pm_runtime_status_suspended(dev)) + regulator_disable(at24->vcc_reg); return -ENODEV; }