From patchwork Mon Oct 24 11:30:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp572532wru; Mon, 24 Oct 2022 10:35:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uz63n1N4Qxywz9ObpID4csMgS97uBjBW1qja697Hl5zbWG8QIeEfI2qVo01tkRknAn3Zr X-Received: by 2002:a17:90b:4c45:b0:20d:4ead:6e3b with SMTP id np5-20020a17090b4c4500b0020d4ead6e3bmr40570490pjb.76.1666632932387; Mon, 24 Oct 2022 10:35:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632932; cv=none; d=google.com; s=arc-20160816; b=H+4vMioT4pNvpZn+7OGYolmt4vTthqFEoGqu9pWhuBYt7tdOLuhKs1dtbvFuGyIcwI Tj+tyra8o6XDf+6bJtVM0AEuYhJdJYWLtbqeh9jQFY2yUIAXmOG+Sy4Thm7A83cM9Mpy ZlHv9Ni9QYpWtXRsFSUAfoZxMXRJ79N8r7EM75bPJEEtF2tAjTNAomdAcaA/zQ22mPyz MPWMrllb9ICl/Qxe5vMQxA0IQhhevvuIsLaISiCboQrJuCvoQ/fTweZMKsv9ik2NHeMN JFnn66kGWRtnxIJBrZvVf6AMODmvpS6q+SqF0VtJMuCnnnieJffLLzeGgs8BAKX9FYvX CebA== 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=qWFqiEeGZmqcWOMXUVigVT0msLAk+Sw1/4oXwxBjZ+M=; b=VJkMOpvFdjVx9bQFx9SYGKH3/pr8pYA2kuR47NBO6Doz0W1Vf8dtEB9VVWjXzt+7HW rWCzHgnfa995T6p6tHFxh+nzB63VRu/tjw7/zgzJ7u9ZTXwdrWfPHLp4KW7oC/f5xcIP ukW+ZS28rzQkELtgHUaMJEUG7j6HktynwOyy8V+gwSzkTwmNFANhsDx2QobuI+BCzPIO fzNc4R5Vcu8aerMtAP5V0sfgpIVmG4Leh9CIvEQdCf9NrkePvYAVZ6FKx+ojiL/2vP0E x83kp7nsw4v6Hwgpg7PM6JGE2NI3TkdDmaAlEY8A8HSj1efNMJ3QKBu71YfjROHoUdnl D12g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M5t6zc8N; 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 s23-20020aa78bd7000000b005633c373dcbsi281885pfd.147.2022.10.24.10.35.18; Mon, 24 Oct 2022 10:35:32 -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=M5t6zc8N; 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 S233239AbiJXRc7 (ORCPT + 99 others); Mon, 24 Oct 2022 13:32:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233428AbiJXRcF (ORCPT ); Mon, 24 Oct 2022 13:32:05 -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 E763DE0FC; Mon, 24 Oct 2022 09:07:28 -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 E4E66B81289; Mon, 24 Oct 2022 12:26:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 424CAC433D6; Mon, 24 Oct 2022 12:26:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614410; bh=43hCi9kwgxotGOGQYEO+J/HJrzuryoYkehb67txsiVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M5t6zc8NwFQZ98kRD38v5AI4bwtUc+cEQuLqIFhBWDVzTkVgE4kuMpsBXhLQkiF6L 08nQvIORix2F7mnqfwhAzqdkj76inabSyCqxlh8/Os8hmKz0OKmzgFZ02u5rcBTWXZ w719KU5aIT2G7THo1bwhDRNkH6rS44uZGkmAAkmo= 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 5.10 249/390] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Mon, 24 Oct 2022 13:30:46 +0200 Message-Id: <20221024113033.461031082@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747591293821133665?= X-GMAIL-MSGID: =?utf-8?q?1747591293821133665?= 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 768d556b3fe9..5c3d642c8e3a 100644 --- a/drivers/mfd/lp8788.c +++ b/drivers/mfd/lp8788.c @@ -195,8 +195,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)