From patchwork Mon Oct 24 11:31:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9584 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp528151wru; Mon, 24 Oct 2022 09:01:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xBFS//x20FntgfZLV5XXmj39//ddgJ3TtKyoy/3oXXMHt0C6md6hAC4QdzQRYUioMLQLw X-Received: by 2002:a17:903:2d0:b0:183:ba7f:a67b with SMTP id s16-20020a17090302d000b00183ba7fa67bmr34336174plk.42.1666627308985; Mon, 24 Oct 2022 09:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627308; cv=none; d=google.com; s=arc-20160816; b=oZjrumpA43ecpRbqrN86e0kmNFjzMklkuIVzwaj8FMIpGjsFxqXRWN4TjWQX/Wo1cf ckuAC0jwcnKFCM8vyQ6LxONne0zG0bQt10LfoFSDXcqMJ/kGyyo3nx1oblaUT3FD74P4 WectEVhkigZFC3FFsUXMGyUinuS9ZLtwYvcZszMHIkMCZYMKNj+o0gW8+5+SYs86/lq9 YRGIlfFTp5jQYJDu/GSHzj+iHslS7MDCaYYEQ2kuOWpwHylUdcSJXzaWR3RQZ95+lziy FuoGqV8IqnQpwDSnOa9KsXS8Hog8FepNeNO8ogWwYGSPCdLp4jktByzaJog9h7RnrgRa 5b7A== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h64-20020a638343000000b00460c07c5542si4143667pge.407.2022.10.24.09.01.33; Mon, 24 Oct 2022 09:01:48 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585397185447363?= X-GMAIL-MSGID: =?utf-8?q?1747585397185447363?= 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); }