From patchwork Wed Oct 19 08:31:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4800 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216319wrs; Wed, 19 Oct 2022 02:18:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69d9h7KWRBEQ3y0yQtIzeJ7evry04HXgmt+DnLWJxAp9cp5zhlJClX9Ragm3hj+R7nqayd X-Received: by 2002:a05:6402:d75:b0:459:fad8:fbf with SMTP id ec53-20020a0564020d7500b00459fad80fbfmr6407920edb.0.1666171087050; Wed, 19 Oct 2022 02:18:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171087; cv=none; d=google.com; s=arc-20160816; b=jXbL1EiwEwuLoHXTqwMtP+H+Yf0D+4BOAWIncjo2wSN2Rfi3uCNKVDkAW85LJ+///H KTye7y1xBmVXIITmrY7pgh06mCmkvDEA+YdItIETkvWcHV8kHCBEpGhTl0wMGypZjSGc 0YFwlSxrsqqy8Ne8f/mE1N45J56Chxje3hk9tWJB0v/gngOD/MuBeUlxg5okiuVrcPrb SD+M89/AwsP9kejtibR9q4KR94zmTGzQVyCjbXAfAXMnOFxB/03C6XjKXIt6HhJZnPmD xo3N7a03Anjm3XUSx902cYTmaMF9SKr2PCjp1gm17Gil5ndoNF4o+6qwfJ2Q7EPAt2vM YoLA== 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=/yB1Ibw3wCLACPtCe4w/w4R9JkSResqOfKHH1PCnfio=; b=gRUBzfZ4AKYQYGMCTEdWJXrmtDo5klV7c4pjOkI1A9j12UngcpcxumNWsqC9O7LLYy qtfGO8Dl5EqvpYhpoYLINVROl2aHT/ikv3LmpomWG0CfySz7C9yo22NTGUVQcEWjFBZR EWC0ioYb2Cgx4p/b2RHM0RMP6goU1qyXNhEZw2431BjqvgGXYlheXaltbVG+WgVAl9EK cPMYZU1j98Fy9xUiDD/ZUYY75ZjyHy8ZWN2s8TgNq1331nPX+ei//vpOM4AiFovDpm5B LuheaZwnfQHAQJb4y5Q4eg3SOoqAYl40ziBw5pORoUjsx0jrCRGYSjlzqMa6rnalHgBN HLBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oUi0ZhXF; 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 l13-20020a170906794d00b00781d6cda765si15054165ejo.913.2022.10.19.02.17.42; Wed, 19 Oct 2022 02:18:07 -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=oUi0ZhXF; 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 S233150AbiJSJRG (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233203AbiJSJOL (ORCPT ); Wed, 19 Oct 2022 05:14:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05ACBF57; Wed, 19 Oct 2022 02:04:21 -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 dfw.source.kernel.org (Postfix) with ESMTPS id A20C46185F; Wed, 19 Oct 2022 09:03:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA90CC433C1; Wed, 19 Oct 2022 09:03:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170228; bh=WXxZPIWiyubGD4UyoxgS6nPk1TseZmuCXaYHcZUh6f4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oUi0ZhXFEkVmHWIecD/eeEMxwt7SlHn+vjwTxOQMqZZTrfBtFZYZ0gy7I+vLQAU5w nVZJObeoBDQM23wDxCJ60SkyId465xYqvyWWNA8nOEl4oKRVBCpvv33nt07sBpI428 0qiPfJ0RBUP/5+3xVqtoCTO4f14CRdHjQWaQeykw= 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 6.0 576/862] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Wed, 19 Oct 2022 10:31:03 +0200 Message-Id: <20221019083315.421760313@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747107013889414096?= X-GMAIL-MSGID: =?utf-8?q?1747107013889414096?= 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 c223d2c6a363..998e8cc408a0 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)