From patchwork Sun Apr 16 07:18:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Zhang X-Patchwork-Id: 673707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46EBDC77B7A for ; Sun, 16 Apr 2023 07:20:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230029AbjDPHT6 (ORCPT ); Sun, 16 Apr 2023 03:19:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230191AbjDPHT5 (ORCPT ); Sun, 16 Apr 2023 03:19:57 -0400 Received: from hust.edu.cn (mail.hust.edu.cn [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC07F35A2; Sun, 16 Apr 2023 00:19:51 -0700 (PDT) Received: from van1shing-pc.localdomain ([10.12.182.0]) (user=silver_code@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 33G7JSXa010638-33G7JSXb010638 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 16 Apr 2023 15:19:31 +0800 From: Wang Zhang To: Peter Korsgaard , Andrew Lunn Cc: Wang Zhang , Dongliang Mu , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] i2c: ocores: add missing unwind goto in `ocores_i2c_probe` Date: Sun, 16 Apr 2023 15:18:54 +0800 Message-Id: <20230416071854.58335-1-silver_code@hust.edu.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-FEAS-AUTH-USER: silver_code@hust.edu.cn Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The error handling code after the err_clk label should be executed to release any resources that were allocated for the clock if a negative error code returned. Fix this by assigning irq to ret and changing the direct return to err_clk. Signed-off-by: Wang Zhang Reviewed-by: Dongliang Mu --- drivers/i2c/busses/i2c-ocores.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c index a0af027db04c..95efad5a5a28 100644 --- a/drivers/i2c/busses/i2c-ocores.c +++ b/drivers/i2c/busses/i2c-ocores.c @@ -697,8 +697,10 @@ static int ocores_i2c_probe(struct platform_device *pdev) if (irq == -ENXIO) { ocores_algorithm.master_xfer = ocores_xfer_polling; } else { - if (irq < 0) - return irq; + if (irq < 0) { + ret = irq; + goto err_clk; + } } if (ocores_algorithm.master_xfer != ocores_xfer_polling) {