From patchwork Mon Oct 24 11:31:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8835 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431481wru; Mon, 24 Oct 2022 05:43:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ks+/7vqyJisRiOiO69/dPk2M3V2W9PBHB0m72fdUM0ZbqR0A4zQzzv2gdiTjt7ArcjoNH X-Received: by 2002:a17:90a:fa46:b0:20d:5efa:84fc with SMTP id dt6-20020a17090afa4600b0020d5efa84fcmr72311130pjb.20.1666615435952; Mon, 24 Oct 2022 05:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615435; cv=none; d=google.com; s=arc-20160816; b=PSlraFsUKwDqOtVQZFcGlp+Mjz55OfBI3xvdSHsGxeJgCzhLVqlxMdEH2qW/rks93x UB0IEzo6dbHA/9nfwl7GHLd7qnlvYv6Opqp5+hltE+18kIhfd9sGDpxj0BkUVLA9+hJ7 b8q7kMNbS2EyE2vDpwslQf5CNBg64lg4Vr/N4nqRWtsqdtJ6tEQKRCgaNE/rOsXJHgEL 48dWKIxoL5ZMpTi1ZSW3Fj/CwqnvOo5qxVDzAVcs3bNVXOlv0esHVqanCJMbZa8sW/nl 8BUuTRj9CCH1tumR5ur018dc39YmLEI4R8a8f6/xP0GMNFONyIWmtcMCih4yMAUhq0eo yw6Q== 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=bGYkcRzXeCAzcqDJnA1rvQdwA+D8NasghsBaqTNRHeYBH6bET9r9IeFjpqBMiNMh3v cbKnliOcHHqIj6jCi4qIa4hGv7yhJx+1IlIpy/V5pTeTKVybwYquL13HQtXscrq1zoGz ektqlQbvVUqn6WVSrLZc/5BUATfuRdXeZp8IVTyMV7erGVwbHt8qSmnrPuH0gm39K6GP qe+TXvmV/MCbalytgFORcP1oCcnJ7BKX9KBXVyFgFvC0do6QySKUwdEiutPS+rlsUTgn /VNRtdJsozy+P75WX6Z/llLwveXutVR09Rza7w5hDtGjMj0aY0idtbh7u0pBbNBivjf/ TvMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WH8d2+TD; 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 f6-20020a056a00228600b005352aeae657si3046865pfe.199.2022.10.24.05.43.40; Mon, 24 Oct 2022 05:43:55 -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=WH8d2+TD; 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 S229491AbiJXMhj (ORCPT + 99 others); Mon, 24 Oct 2022 08:37:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233883AbiJXMbc (ORCPT ); Mon, 24 Oct 2022 08:31:32 -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 CE22B1EC5C; Mon, 24 Oct 2022 05:04:42 -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 9FB66B811C4; Mon, 24 Oct 2022 12:01:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0016AC433C1; Mon, 24 Oct 2022 12:01:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612917; bh=7Mf8pAymLKtC4kysmJdpY7SrgzbFoAL52CT2NFcnYPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WH8d2+TDwLJ5/N564TTn04sLP256U5QxUJCNysYeKiNwFO4VEGLOV7pm5POXvMN6T xcmBgnsS79hij97pem0Xh+J6pJj9liBWWLKOkoNCcYwihaxgP8sph2WqckVAE+RhxB ojeBgEnPl2WXP+VSOGHmLSvsNHXgWo9QUebPwIEk= 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.19 151/229] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Mon, 24 Oct 2022 13:31:10 +0200 Message-Id: <20221024113003.892784504@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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?1747572947283365002?= X-GMAIL-MSGID: =?utf-8?q?1747572947283365002?= 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)