Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7105889rwi; Mon, 24 Oct 2022 09:53:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+nUMy0+ycQ8Mv4lBuyyrl++VABpsKYabp5cZ9nl5BlfPJ5XvslMLVhqfT58xNPU8Q7onj X-Received: by 2002:a17:907:7da5:b0:78e:2c3b:55a2 with SMTP id oz37-20020a1709077da500b0078e2c3b55a2mr28142779ejc.96.1666630416662; Mon, 24 Oct 2022 09:53:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630416; cv=none; d=google.com; s=arc-20160816; b=N/+gzvqTC6JG043NhkJoV0RIq595XqlQCjJEvEJZiDiKLI5gMj9yc6t9QL2t+cmSR+ J4zC0Jyhuwx1Lw7I4V9BQjDfkHgHqNLK+mpr4n0J5Rbnq9OlkX+Fr10hGjmIGvuO345z TfpOxrvyFoTs19nKTc9/wphpHSGvzlwX1DJExmQiNdYsZjNNLidb9VmqIHrEdLJDRAEx G3o3Ph/VKxd7oXVK+zZtwSz4HBiNO4Rk70HQykuVpQ3W6xdYwt9QVyp7x4OKPgXj1pwc yqIuul38x81EhYnsk1P85L5Ta3E3oafQ70NpfV3YfbGPrkT0wYKtsmwOM7jaDaTMVLtu UeYw== 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=ncrh4LKlHVvQtYJT+QR1ULqI34OmJaPmyfVts/ndP88=; b=EmOL5Nq4DrKEVL/70AwzYIslWO4x3MHfOtHxytcn3uzVn3OsK3FGio3drFwRG37YEW IENPLCmQK902GGv3wyhAX/VaXsQh8Zpa0VDjX6qHNHbKXOLlZqL2cC3SqeR62lIHqzyr 88G64+9jcGVO91NNf2jV0geJd8ZODJxEalH8EqQwB2tavBvMHHqCl2Onj68se9n5qI9h AMMytH0mpjs/nrB9k4gPA6uRYT30bKX1HJN2eFEOUv4Y08iqzsqck0k54ciqQf+kh7Ol QT+jzSYITdsYY5R2dvIO6JdaqQNe25XpGSzCpykXgHlgqoCynvEXWtgZnj/XaPYSeG6b HwPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jHIstq0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d21-20020a17090694d500b0078223ff2756si242900ejy.244.2022.10.24.09.53.11; Mon, 24 Oct 2022 09:53:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jHIstq0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231748AbiJXP6E (ORCPT + 99 others); Mon, 24 Oct 2022 11:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231642AbiJXP5Z (ORCPT ); Mon, 24 Oct 2022 11:57:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC3C1E26; Mon, 24 Oct 2022 07:52:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 980EAB811A0; Mon, 24 Oct 2022 11:45:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E15F0C433C1; Mon, 24 Oct 2022 11:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611899; bh=+IJfdwQZHLdBxmVW+3yGX0T13fs3Qxpi0bql/8osMgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jHIstq0cNdlnyTgeP6U2vXmE7B1vitDwKZwqa5S9HgGRG5ZHimQOgqrYnUQO9JLBM quQFz80skLh30mzSEvakGPZ4bvby6h28NHdz28hx81rTjGhaggIZJbgTfaTjJNLx24 UkUZmEOMSUPxacOsZLRX+/tOL0IF0/QpsG24qxyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Lee Jones , Sasha Levin Subject: [PATCH 4.9 113/159] mfd: lp8788: Fix an error handling path in lp8788_irq_init() and lp8788_irq_init() Date: Mon, 24 Oct 2022 13:31:07 +0200 Message-Id: <20221024112953.596139680@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit 557244f6284f30613f2d61f14b579303165876c3 ] In lp8788_irq_init(), if an error occurs after a successful irq_domain_add_linear() call, it must be undone by a corresponding irq_domain_remove() call. irq_domain_remove() should also be called in lp8788_irq_exit() for the same reason. Fixes: eea6b7cc53aa ("mfd: Add lp8788 mfd driver") Signed-off-by: Christophe JAILLET Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/bcd5a72c9c1c383dd6324680116426e32737655a.1659261275.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/mfd/lp8788-irq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/lp8788-irq.c b/drivers/mfd/lp8788-irq.c index 792d51bae20f..ae65928f35f0 100644 --- a/drivers/mfd/lp8788-irq.c +++ b/drivers/mfd/lp8788-irq.c @@ -179,6 +179,7 @@ int lp8788_irq_init(struct lp8788 *lp, int irq) IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "lp8788-irq", irqd); if (ret) { + irq_domain_remove(lp->irqdm); dev_err(lp->dev, "failed to create a thread for IRQ_N\n"); return ret; } @@ -192,4 +193,6 @@ void lp8788_irq_exit(struct lp8788 *lp) { if (lp->irq) free_irq(lp->irq, lp->irqdm); + if (lp->irqdm) + irq_domain_remove(lp->irqdm); } -- 2.35.1