Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp479736pxj; Tue, 18 May 2021 07:39:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEYE0bpHbGCS2iNLHdNLrF1fBjvfw3mj6EjN+FtK4rjNKKqpIoOfghQvP4tPWnDZyigngg X-Received: by 2002:a17:906:1185:: with SMTP id n5mr6412039eja.342.1621348763205; Tue, 18 May 2021 07:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621348763; cv=none; d=google.com; s=arc-20160816; b=hh3WzvHdcTlO8fF/FzFtK8Rvc1fLlWxWr3+BGSjAjEJYNzkiZi5d3X/lFnraD3y+va A5RL3SsWLrZnDJNq0DBQumC8BQ1ZjV5obXOhxo5yMqGRTRnev6uMYH8E9ZrFBhGeeSqR hO7k5PeQ7TRRIA+Zkpf+qPAJe4dGZemkBG1IB25Q1gKGQsY425/ncEXvD7uE+BfZveWH UUzwnZcRWZ+mk5kMtmHuMFm1V9VjjwRpysNedGcF7o2xT+MrPuaOCn+zC4XuAO2xdxms 88oJrpZymS48Udj5lI3k/5rgE+YbSMRHqsaUM2sjkE9VUDA6kSK//I+EbKgrlt/CVPFh dgYw== 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=LNmO2h4SNE6cc65bPf1eigOCNDXg6BEKx4PXQe+DGKg=; b=cZ7d0Fz1nyEFZ3toeG9yZzdCcn5a79lM5OCZ5+bP6OZqxcOUc2eP+3EL5vE9LBrPrf VVj7ycChDFmP0oVMvKH6G0uipTSAh5tQ1QPqPFEuy8RbyyO4SA91nSa3NJwXfMc5FOle qrytrvgaFsbswfkvvvmNDXZvt50WMZry6qY68z+bmGHL2Sht4mMv24WQVI6YimYxK3SZ 9hxu4PeFHobYkvM7bYwaf0pFkfiefdtePxICtbp/pn7AXSWPHVJkqA69/ab4IZqZQ08o 2vmz5/kzzKSp7RVah5HrPZRDD/RJsgcb0lfrUDcdZQV4F2OWSul/a/Mw0HZa7fjRgaGm /Pkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=W3Nhm1p5; 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 da5si17429286edb.393.2021.05.18.07.38.58; Tue, 18 May 2021 07:39:23 -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=W3Nhm1p5; 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 S237655AbhEQPrp (ORCPT + 99 others); Mon, 17 May 2021 11:47:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:58256 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241265AbhEQPb5 (ORCPT ); Mon, 17 May 2021 11:31:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3E6EA61401; Mon, 17 May 2021 14:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262306; bh=nrLbR1qS2oetQEG6q1ppywEyY3I4leNoq2ksalzIrvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W3Nhm1p5e832dRDuWJjpGoWMd8w+X/wPAcLaqZrnKH67ddDZuPIUj6tVlrWB4unxh vbuv0gTPR9FXMsmPF5+sXip03rOnTxwwVcwivXzU0QvlL4Wqj7GOsy+nH9vUC/ZKPF wqSGWu2Lg2z22ofbBikmrYAf69nISLT8ThpNKsk4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Linus Walleij , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.11 261/329] iio: light: gp2ap002: Fix rumtime PM imbalance on error Date: Mon, 17 May 2021 16:02:52 +0200 Message-Id: <20210517140310.940874820@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.043055203@linuxfoundation.org> References: <20210517140302.043055203@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: Dinghao Liu [ Upstream commit 8edb79af88efc6e49e735f9baf61d9f0748b881f ] When devm_request_threaded_irq() fails, we should decrease the runtime PM counter to keep the counter balanced. But when iio_device_register() fails, we need not to decrease it because we have already decreased it before. Signed-off-by: Dinghao Liu Reviewed-by: Linus Walleij Fixes: 97d642e23037 ("iio: light: Add a driver for Sharp GP2AP002x00F") Link: https://lore.kernel.org/r/20210407034927.16882-1-dinghao.liu@zju.edu.cn Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/light/gp2ap002.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/iio/light/gp2ap002.c b/drivers/iio/light/gp2ap002.c index 7ba7aa59437c..040d8429a6e0 100644 --- a/drivers/iio/light/gp2ap002.c +++ b/drivers/iio/light/gp2ap002.c @@ -583,7 +583,7 @@ static int gp2ap002_probe(struct i2c_client *client, "gp2ap002", indio_dev); if (ret) { dev_err(dev, "unable to request IRQ\n"); - goto out_disable_vio; + goto out_put_pm; } gp2ap002->irq = client->irq; @@ -613,8 +613,9 @@ static int gp2ap002_probe(struct i2c_client *client, return 0; -out_disable_pm: +out_put_pm: pm_runtime_put_noidle(dev); +out_disable_pm: pm_runtime_disable(dev); out_disable_vio: regulator_disable(gp2ap002->vio); -- 2.30.2