From patchwork Mon Oct 24 11:31:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8487 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403724wru; Mon, 24 Oct 2022 04:53:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6neAGMJUERUnxXa7euQfl6xlaqwpDAAcTwtm6kPOKQktYZtQxrEj+HJl7q1PH43OOxTNv7 X-Received: by 2002:a63:e52:0:b0:438:ebec:363e with SMTP id 18-20020a630e52000000b00438ebec363emr28172224pgo.437.1666612389245; Mon, 24 Oct 2022 04:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612389; cv=none; d=google.com; s=arc-20160816; b=PST38xZmUC8goIotL8SRJmDZMky9F6ONfmOTD2tUgsHMPO0dUevSS0XATOnWhGtqnl w0vlAFJRjgGVcReKxccPYQi1YTHBBNuIdKkOK3UH92wCHwD/MxMj3NqXqR10H3FjXUPi COnNDJnCtZs7++2UcVMto4bb3hEZZse6M9GPb1hH+SnWjnxnBaZkJq+J8F2yGaptxyi0 bepRy3Df76OoJZxHj2r/iELB5wQ7lXva0Xsdqlv7QQbPj2FBl3wMeC0B+hHtBiqndWVK v1tRu+eZ4WOqql0GxAi9SwcdYlWc1KbHkI40n2k3KYv8COSJGRLFb1EyVm7mBFSuTqXn RfUw== 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=L+A/BSR94ma4LpScF9jqZHK9B+avof+oOFBAQ/rcUC8=; b=diOanVMf8fS7G+ZFHxh8IS2KMgD7SJbOACUwF+wMKeczj3bcRA3cxmOHsTUFZdZjbi fqcxeTaNb2lsvDuqZedBuopIbdttsknKpS0lk4mCqeomwohLc8JDICsVA++CnA1gDPrJ JcFob/KzQbNufoTnkeDsKc7b0ibyNDTM+WgffkC8vOmx4GuKnAGmY6DEVuk0oBPtKuFm UHwDFW6lIPum1550qExtFmAQq756x+GnboI4B112sMyj4BHFWRi37dOpiJ6/6F2V+IeH eQmy4omP7Y7ouLGJ7m2o7OI9VYnavhjENapgvoT3ggp/dGtlUR9j8wnUF1YC1pKdZ6Ru l8SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m3KbnQI6; 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 e23-20020a635017000000b0045a6c6c559bsi34566028pgb.305.2022.10.24.04.52.56; Mon, 24 Oct 2022 04:53:09 -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=m3KbnQI6; 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 S232039AbiJXLwZ (ORCPT + 99 others); Mon, 24 Oct 2022 07:52:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231907AbiJXLvD (ORCPT ); Mon, 24 Oct 2022 07:51:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A14021A8; Mon, 24 Oct 2022 04:44:27 -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 8A62EB81151; Mon, 24 Oct 2022 11:43:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDEA1C433D6; Mon, 24 Oct 2022 11:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611794; bh=7Mf8pAymLKtC4kysmJdpY7SrgzbFoAL52CT2NFcnYPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m3KbnQI60kOsMSBkPkEquHR2eTX3FcMN8fhDElSYGE3j5iH9+N9cqlpM0Wvixoo4s rmINt9CjBoZXdad9QYrCe9XK81fQitrCZ7nMYNNqftjnvyVh0dEHj0BWzUwBaEHhA4 R3ANZDA9oN9HdOWM1dSiZhsDJs5AJWkuCPULivCk= 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 112/159] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Mon, 24 Oct 2022 13:31:06 +0200 Message-Id: <20221024112953.555782463@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?1747569752788295034?= X-GMAIL-MSGID: =?utf-8?q?1747569752788295034?= From: Christophe JAILLET [ Upstream commit becfdcd75126b20b8ec10066c5e85b34f8994ad5 ] Should an error occurs in mfd_add_devices(), some resources need to be released, as already done in the .remove() function. Add an error handling path and a lp8788_irq_exit() call to undo a previous lp8788_irq_init(). Fixes: eea6b7cc53aa ("mfd: Add lp8788 mfd driver") Signed-off-by: Christophe JAILLET Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/18398722da9df9490722d853e4797350189ae79b.1659261275.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/mfd/lp8788.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/lp8788.c b/drivers/mfd/lp8788.c index acf616559512..e47150cdf747 100644 --- a/drivers/mfd/lp8788.c +++ b/drivers/mfd/lp8788.c @@ -199,8 +199,16 @@ static int lp8788_probe(struct i2c_client *cl, const struct i2c_device_id *id) if (ret) return ret; - return mfd_add_devices(lp->dev, -1, lp8788_devs, - ARRAY_SIZE(lp8788_devs), NULL, 0, NULL); + ret = mfd_add_devices(lp->dev, -1, lp8788_devs, + ARRAY_SIZE(lp8788_devs), NULL, 0, NULL); + if (ret) + goto err_exit_irq; + + return 0; + +err_exit_irq: + lp8788_irq_exit(lp); + return ret; } static int lp8788_remove(struct i2c_client *cl)