Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6869161rwi; Mon, 24 Oct 2022 07:06:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ek10uK0Yv55ImkrcR9mcP4PV5jeoQ5jHiKafU51aGb9tznMrVwWUpTzrDfeGz3LHAAAHf X-Received: by 2002:a17:906:fd82:b0:770:7e61:3707 with SMTP id xa2-20020a170906fd8200b007707e613707mr26803933ejb.143.1666620400150; Mon, 24 Oct 2022 07:06:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666620400; cv=none; d=google.com; s=arc-20160816; b=MnRT+hk68qTp3MQjIMT8z4+o641XqaRYlhw3ATFchIOryh9+gqYre5Sn57PbBrJNV3 m4G+CISmc9/q+fphLM4EClXUi2d1UQO5XP/FT7EHlOwJklq1DA2oROkN8BOZ6NikxAPl Gj1YEZnfXlw3/hKnbQcpIYeRmTu0PN+eoMPBJOsXrwEri1blyJQX6D09UiheVg5ehda0 1nRcbfJTmtKt9i4qGCfc9IvPh2bD8s3X2D9wtIn20ST0As8NHsSKGp+Y5ZysGAIqGXS5 2uvqm2xZxgqEuKWFerVf1i8H4cNYY6IPoUgHwv9Owvwcha3Af+GyMfRT2RRaZfgbA5lg 7tUg== 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=CfURw7mTTDBa5JqarRv/pMa12B8IqjunR3fh7KYHLwYD3ZOkUY8cDRdbEjsHD3GTYM bdNHyx+k+a3vN+94MncKryQ4oXxjiSfpXeo2Dpm7PLFiw/80dSr0esCcNhACqdzNwNIC VdG803EmZjwQ6VzTxjnGg0I6E6GdawkxtraNHvUSVvKjm1p89AQ6dHAXyntzPIlEnb59 zCh9JB+IWbjpuZnMKtamFXOl6471FHf1+6G8qePE5Rzr5UBrVyEPFAc5ocXpWHQ2n5yf f+k9/mM+aSfjEtFGpJcU1QxSv7ourwOBNFd5pfXqaGjmP80fRJnHQMb/3K75cbrDdac8 GRGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wRKZIobi; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e19-20020a17090658d300b007829d30452asi35021201ejs.583.2022.10.24.07.06.13; Mon, 24 Oct 2022 07:06:40 -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=wRKZIobi; 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 S236704AbiJXNzQ (ORCPT + 99 others); Mon, 24 Oct 2022 09:55:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236250AbiJXNxk (ORCPT ); Mon, 24 Oct 2022 09:53:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D0EFBC47F; Mon, 24 Oct 2022 05:43:23 -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 8A319612B8; Mon, 24 Oct 2022 11:51:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99A41C433C1; Mon, 24 Oct 2022 11:51:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612295; bh=7Mf8pAymLKtC4kysmJdpY7SrgzbFoAL52CT2NFcnYPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wRKZIobiLqoN/h2bAZMto/dyXbZuPupTBEpQvHv3HSy9o3VB7D13Rla/iXhHADWAV BohnwO1k/rn3NdY0q0y0Gy8eJpsfZicrV+FF2FUn8w1bzZ7FH6/CuuKRigC8s7LmMA Q+5qjzyfpxKVFVspdfy9AGgwiowsHGk6PBxvNyis= 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.14 144/210] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Mon, 24 Oct 2022 13:31:01 +0200 Message-Id: <20221024113001.648355789@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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) -- 2.35.1