Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp598771pxj; Tue, 18 May 2021 09:59:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjOoXHw2oA1JY9ZGTCQOpZvuCNlimtoiKCe7syZkp6b1vIfSjhJjHMx35h9ha6VrxAgx5o X-Received: by 2002:aa7:d890:: with SMTP id u16mr8191225edq.49.1621357167900; Tue, 18 May 2021 09:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621357167; cv=none; d=google.com; s=arc-20160816; b=h4xzfcnu6rQOf57zLBoBdajjBelue7RBPMGT9W3gU7qrVkEDE6RhL5KSy48L0DVL3R 11EeM7AQzNmYPDhBqMvBOO6PuqDDZbpEtI9F4pCNYPeVk/HjFyE3wkjeCnPaj/XfPYqB TaCioydbQD1sA+rsWlDmLE4c5MH5ij0q57KMaHJurHR0LooPcbbkD9AIgeF2oFgQJLtb czkGTsd1xHSXYInY0N4vOJJsBufJ4q5z4ZXYoypopJPB7L/uLBYwS5GyNcaKVsNkjoHW S5sj2SMaGwSRQULHcpSw6+qFlvNoy3ElMi5KDBosP6BFmlSIcYLYQXm4zJ9ES5Vs1Mip YksA== 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=SjK092sqxRshoqrfo+9BHyHh92L5aaUErPwKHFy5DGhPonTeP2M4xqTEsqwm5nxIch U4LuXLLJOrOrYmajszfOut0b1fkXT6rRCFyNvuSUvJKr6syGAjQ1Vm5b+6wCfUr/Cc/q qM9b9DwE1E7X6434FAiMW1Endw2HELRH/qui3xnnjhRbhFZucvLtF+vmPqmy9/trLOfq 4GQemoIyS+6/mafrpYyi90cYK19Q3ymPs600khfWE1lTfKb+PSp8lhtJDJwjzzcSJj2e yzGooJTktEkqwZqba0JguvdvcQlMIjgbzKfSbiMz9v+mC/z2+g9vUS2oAW/BsNwLq3k+ +FYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Nv4Cuf2P; 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 i3si9807716ejr.178.2021.05.18.09.58.51; Tue, 18 May 2021 09:59:27 -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=Nv4Cuf2P; 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 S1346489AbhEQQGF (ORCPT + 99 others); Mon, 17 May 2021 12:06:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:35168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344502AbhEQPow (ORCPT ); Mon, 17 May 2021 11:44:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E594161D26; Mon, 17 May 2021 14:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262605; bh=nrLbR1qS2oetQEG6q1ppywEyY3I4leNoq2ksalzIrvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nv4Cuf2PA4+zPhy81vCIHn4Z6OvDrmjC8fIzZl/yHJJJA/s53b5Mte8ZpNn502/SN 2Plv3+3VfPiXV/UPXDnFXCk09jUerLt1IF2dfxwyEViav6i2DSA6a+pYrOG64BkmDY oM7+UgTCv5EOgrrqPlwUTADgdC93PPGSb7WxBjuQ= 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.10 223/289] iio: light: gp2ap002: Fix rumtime PM imbalance on error Date: Mon, 17 May 2021 16:02:28 +0200 Message-Id: <20210517140312.672769607@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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