From patchwork Sat Oct 22 07:25:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7541 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105879wrr; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4O4//eR4RwIq/jew2NVjV+95xQl6QO6buB1Vxku0SZiKIM0ZEiMWdJJyLlMzfeL45iUC0d X-Received: by 2002:a17:902:f651:b0:184:6925:d127 with SMTP id m17-20020a170902f65100b001846925d127mr23015515plg.140.1666427785733; Sat, 22 Oct 2022 01:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427785; cv=none; d=google.com; s=arc-20160816; b=X09MYOd0lDfSyfvmxnof/k8A/b+FTFmxNW7I+TDEL+c2dn1fW/RJW2uDNzlRWPTUHO XRx2RwzGzVHyF4WhfHaudjPh+PG1A9N+mpDZ2w+Zpjs9gryvl+u4M9kactQRYlMZJypn XqwzZLsHS2T0JfmIfWBtb/VbKUFovWfukzO7vQmV77CO/Abt1MMrb21uTNc+6zxIPkMy pQk6EdfUKvUVJNY6lW4v3/puB9x1CP8YVOPxgP59iy+Vdh1QA1Nw02N9UmEH3I+SPL6l 7OkPTiImhJ/UiFk4nwbqMwUr32CwRIZMljxLmLQ3gH2rt37FCU9odOFJPiN9pXq7wOvM Irnw== 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=edUAlRvTC4clidHXLo0mauKZ3oNw37IAvLxQi3QM55egi/zlv2I9EBzoYAR4CpsNgT ZZql4H7VFDJSzurDhA906GihuDYe0Rw/eOYkX8PWG7QqhppamuupJYarvDR9Uw0XYO0W 6zmnNrFvmHkT/qajV2pKPAGCeIv5v9jbaLUCvc/wWVZR/Rm28vg2plbqG9gq1vABvU0R 9Lm0NCIr07SG3zjEYK2I4yluPv4HhMhrI3GCp5Tm8oGoIqHVeWpzIFzRaps3iU4qWlj4 cK59loiotDJ0HrhA3gRcOd3WTlyq6t02HUHnJZnIoSu9BIJtXJBU5wOyFTJRHdk249sn F0QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EoHdymRF; 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 mh10-20020a17090b4aca00b002088ad6d93fsi2448980pjb.49.2022.10.22.01.36.11; Sat, 22 Oct 2022 01:36:25 -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=EoHdymRF; 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 S230167AbiJVIR0 (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233944AbiJVIPk (ORCPT ); Sat, 22 Oct 2022 04:15:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B50D2DA754; Sat, 22 Oct 2022 00:56:36 -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 AA2B160B45; Sat, 22 Oct 2022 07:55:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C13D1C433C1; Sat, 22 Oct 2022 07:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425336; bh=WXxZPIWiyubGD4UyoxgS6nPk1TseZmuCXaYHcZUh6f4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EoHdymRFmHfWi4gLAQnFr7RxPu4FZ5CWRCj5kjOjniDq/k6z7dDA9xWDKEgt8C6Ir lBgWxNKA14eQqezpZQLbJwb46rGryQBTjeJ+4qf7E3+h/b5Aooux5sqkQ9rpUw3n+G wDZ7iEdU1iIkhowJeOC48DhdZS5ZapXHdj6H07uk= 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.19 468/717] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Sat, 22 Oct 2022 09:25:47 +0200 Message-Id: <20221022072519.006232101@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376181462946578?= X-GMAIL-MSGID: =?utf-8?q?1747376181462946578?= 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)