Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp34379pxj; Mon, 17 May 2021 20:11:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl89QcqIJBu6C7fWc90BRf3t9kz1KeuOuT/i6TvpZEDh8F4Z4L8oguSgPLTPW3TVenQyUA X-Received: by 2002:a05:6e02:d:: with SMTP id h13mr2416877ilr.112.1621307470722; Mon, 17 May 2021 20:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621307470; cv=none; d=google.com; s=arc-20160816; b=oJk3DstxytESH+ncxOjO9/gIznX8V7p+N5R6rS2ypU51DtQIDyuHNnCPTl+z5hLXOc 7Sr7qBCfblh/CssochP8fizYihwhhLljA+YwnJs8ASz43QVBtVC5OSYty5Qm+pd5fDW8 2HSn/3OLQ6ReYsXgDYPsXyXth9VXwWG4hAtwnTgHyInYnHu+8STCj5yZIiMN0c8mSmmV zTCIKzCLY5hsXiFEZYF3MDv3/SULKUf8UvThq4Ex59fV3VhvjmEQ0ynxRVsaFbpnLOEr 3qEWfFP59W97Yp7gCGTPKTizi4B29T+O0M0aHJLd9SXLHus7KhMBTaLq0zle85oo8Iuj DuxA== 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=qCbcQ5JOE4yLAheiatW/1s7VABiX015qiri2+2XxkiNtYO0fnBd8/3CHE5NsLPPp+Y avM+qyxdkfI7KQGXALux5zX4Cz4ql4Kfl3F5vRUCEsZZ3ASVILp+A3aGRAN0/LKrFybL 3Y8yF/dGAVSyEJi8y6BCfkrTyKlI2qxiWpwLRvoJ4xHAWq3PH5pW5B1ej3X6ddxQ/dl9 FhH3aB1APwnv19ToYg7H0GXdpVhYcNFlGTK31eIB7YZUgPO39L4TF6pd6F3arX6t/Y3p MBh77pvOZbenrIUK5/ol0txMg5+zp/qKgo4YqoIJCI7hXQXU5H1+4ze3i4cSNsR1zXx3 L2kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IeybBuTZ; 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 g8si10416764ilk.127.2021.05.17.20.10.57; Mon, 17 May 2021 20:11:10 -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=IeybBuTZ; 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 S240610AbhEQOiw (ORCPT + 99 others); Mon, 17 May 2021 10:38:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:44534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240369AbhEQOeJ (ORCPT ); Mon, 17 May 2021 10:34:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E9B2E6100C; Mon, 17 May 2021 14:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260994; bh=nrLbR1qS2oetQEG6q1ppywEyY3I4leNoq2ksalzIrvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IeybBuTZRFvjmrcA1H0SLtnlGJbAfKEJwQoD1wX+BZLNfL71+ynNMUecqcbyinc2b n9ynj505VFFZdNQtmXIIEZNzhsSO2ya9k0Ff4Hz32HqoVDf7W/0NRd/99uIDgvBVMc eybM/ChJkHFdJpAZ0ffZuyTj0AELY0n17xQ+7Nwg= 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.12 286/363] iio: light: gp2ap002: Fix rumtime PM imbalance on error Date: Mon, 17 May 2021 16:02:32 +0200 Message-Id: <20210517140312.270894612@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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