From patchwork Mon Oct 24 11:31:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640433wru; Mon, 24 Oct 2022 13:32:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41s0QxMRM2idp4tqLGFbrlmUwKEn1ljgPx0uUxHkBX8zjMnlKtWTxuCpXQlxLggigWbhhE X-Received: by 2002:a17:907:6d25:b0:7aa:f5a4:5f66 with SMTP id sa37-20020a1709076d2500b007aaf5a45f66mr2553386ejc.216.1666643559002; Mon, 24 Oct 2022 13:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643558; cv=none; d=google.com; s=arc-20160816; b=yKCaHEW4tq15I/h4/7gSJEzHE1VPfeoYCiIXhRbPzX9HScl4CFQHGP4+aS45TX3WUC lgOM7PILPcBklP/n2HnGHa9cmbR9iRms6cPTcUkfwCpgxaq+7Rz6RwlZzhLlHO/ZpXSZ Aqb6njdOti90MV4+OWLA+Y0kp18tAoTXSYsIplnqTvLrcGMEbTUvMANC71zkiKgHjDLe ySmxtLodiOPtnasJOC2VxJQ1R7LZK+uh7M+ZbtDnGA7Ktk6+MzYm4HPgHOs7qMs6DxGG 9TKVKf6xHsbQCb/Sq7qFMEGmcHge0XqgAYIUxPdRvtwhYu2trjwJ2XOwjSDWpfthVV+i pmiA== 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=0QnAMir1V2+3d8ZhJbQZLAnc8aQ538eoNKmhthGkOqFatW3nVh58r2PxSyEcHhbsW2 OV/+OOoItO3oXj5+d+d+pMHAhicZeYotoMSdrbRGUiQ5xAbUhqJQCD0WG7/ISPkyAx2D PGq/CTLJ6M9DYN0H2ICMl9D/0RRDq3YH+MCxiHfaAydYp5YLW5NOsKysDvOIgeMka7sf E9RKfJJ4X8AA7k1SlHWbn0i+btAeJo9AjfS4iNFBVSnk33E0fnZLe7wBzQP3X1gy9Dcv qfzjH49VdQmOHHZsCKRBJYtjiYWATa+cbXgTKtaY7eJN/rt07v+lYx9/xIGhN8QfCpY7 vbHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FrS1kHVL; 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 hb38-20020a170907162600b0078dcdb1c9dfsi734074ejc.553.2022.10.24.13.32.13; Mon, 24 Oct 2022 13:32:38 -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=FrS1kHVL; 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 S233264AbiJXUWZ (ORCPT + 99 others); Mon, 24 Oct 2022 16:22:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234217AbiJXUV0 (ORCPT ); Mon, 24 Oct 2022 16:21:26 -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 529DB31DDE; Mon, 24 Oct 2022 11:37:48 -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 ACCF8B815E2; Mon, 24 Oct 2022 12:12:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11C73C433C1; Mon, 24 Oct 2022 12:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613576; bh=43hCi9kwgxotGOGQYEO+J/HJrzuryoYkehb67txsiVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FrS1kHVLsjnw8CY94nYZE0uR+I3WizPvaCBFu+UIMd/chFTfNK/xVSz2bLmogqAwb FJdG+t0PxM8CMUYIJaw1rl7y0xcC56mWPg9JaDVlQbQlzdrI2QlKNA/cvKfCJyv2qt 2F3ALJtWCvk5SOn0oZXYRoSo2O74f3HdqBagvUbs= 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.4 159/255] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Mon, 24 Oct 2022 13:31:09 +0200 Message-Id: <20221024113007.950152920@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747602436687802639?= X-GMAIL-MSGID: =?utf-8?q?1747602436687802639?= 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)