Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp999048ybp; Fri, 4 Oct 2019 08:08:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0/5YkAm4pE0PKMAtnWsmwfngcZIigxwZr9UeJ03sDhJo8YdNk2EcDoIyZZTItWUhTlNnr X-Received: by 2002:a05:6402:713:: with SMTP id w19mr15542319edx.126.1570201728308; Fri, 04 Oct 2019 08:08:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570201728; cv=none; d=google.com; s=arc-20160816; b=SoeXTR65usSPQxHXneR7mR9Zmma4/q4Ssnus/Iz/NbuCHt8K6LGgJW0xIFiRHZPIy+ GNfiq3MoILBsM/pXADJ+TDcE+PJSouRZLEyKhEXeDNOvsLD/NiU+6nCKqpMGVC+kay9r QzxTNqqzFGkRck1lbyOaIVDimZK7gaFQhAuVbzmQndhycvUBs6HqbeEuN62ufT53fEWT 6YpOU2/942BDi+Kb+WMfsjEsKQ4fG8WW3nQNz7xkRXUYMfD0cPZe6bZb+ubUdm9gGHXs ms7lRGoAdszRb2lhKEirsAw0u/fLXZFFaNifJRoijf550NelByiy7w/BvPPVcWUbfFJH odpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature; bh=tWHuhaCmV7dqgW1NMgso5tsJw85i+JPuBgyPhm05kbQ=; b=TiD6kqXuSBPsAk0StwbwnLL3SLzXTObbgj9Fhwew2HoZv0RoQIv5jCanH8mD5mgyLP 2TjC3qlTYw5nlCmpXHteTJUnb3ep4dmQYH9yFi9pjjBYU9dp0/pNA7Hd//S7SpZWXq5S UTgIuDPfhzKBQXuUWOt3Rrx6XZdona3GqnnMPAzG7o43RZeFS2EcJXNfq8m9ZVUH85JI qe4+0IjGdDRQ9XugnsnNq4Vu0cerNeZZ1uwv3owqCR5lH7bmJAAx3fmT9J8Mxm1Z0OtB NIAtrWeSr/cfEHw9BPf9Vu1yD7hmC4N84OqTyPmuojv9WD9kNKOBSegvIZcMyMA/X2J4 wpyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QxMOULfh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10si3069883eje.50.2019.10.04.08.08.23; Fri, 04 Oct 2019 08:08:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QxMOULfh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389627AbfJDPHv (ORCPT + 99 others); Fri, 4 Oct 2019 11:07:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:50402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388802AbfJDPHt (ORCPT ); Fri, 4 Oct 2019 11:07:49 -0400 Received: from localhost.localdomain (unknown [194.230.155.145]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F257521D81; Fri, 4 Oct 2019 15:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570201668; bh=qYioEzDmICb0pDIcd2sao32iGGG/DdI1z0g1uD+bG7w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QxMOULfhqAHILdyIZyGrilDN3NMOHFLVFs1DQK2m3A3Kgc53Sy9lrgf6WfAxseFC7 z/lVWyJmrLK/sgW43+7YUZGRN5UNjWPy69Cgt2uB4Pdv/a3PxmdjvZmBIc5ZgVPMqg 1nZLHnCqZVXtqEkiGjZZ4X0sMtIH74tEyFJS6YWA= From: Krzysztof Kozlowski To: Sebastian Reichel , Krzysztof Kozlowski , "Gustavo A. R. Silva" , Linus Walleij , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFT 2/3] power: supply: ab8500_fg: Do not free non-requested IRQs in probe's error path Date: Fri, 4 Oct 2019 17:07:37 +0200 Message-Id: <20191004150738.6542-2-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191004150738.6542-1-krzk@kernel.org> References: <20191004150738.6542-1-krzk@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When requesting interrupt fails, free only interrupts already requested, not all of them. Signed-off-by: Krzysztof Kozlowski --- Not marking as cc-stable as this was not reproduced and not tested. --- drivers/power/supply/ab8500_fg.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index 36bbb8ea05da..7d879589adc2 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -3158,7 +3158,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) if (ret != 0) { dev_err(di->dev, "failed to request %s IRQ %d: %d\n", ab8500_fg_irq_th[i].name, irq, ret); - goto free_irq; + goto free_irq_th; } dev_dbg(di->dev, "Requested %s IRQ %d: %d\n", ab8500_fg_irq_th[i].name, irq, ret); @@ -3173,7 +3173,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) if (ret != 0) { dev_err(di->dev, "failed to request %s IRQ %d: %d\n", ab8500_fg_irq_bh[0].name, irq, ret); - goto free_irq; + goto free_irq_th; } dev_dbg(di->dev, "Requested %s IRQ %d: %d\n", ab8500_fg_irq_bh[0].name, irq, ret); @@ -3215,7 +3215,9 @@ static int ab8500_fg_probe(struct platform_device *pdev) /* We also have to free all registered irqs */ irq = platform_get_irq_byname(pdev, ab8500_fg_irq_bh[0].name); free_irq(irq, di); - for (i = 0; i < ARRAY_SIZE(ab8500_fg_irq_th); i++) { +free_irq_th: + while (--i >= 0) { + /* Last assignment of i from primary interrupt handlers */ irq = platform_get_irq_byname(pdev, ab8500_fg_irq_th[i].name); free_irq(irq, di); } -- 2.17.1