Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp2959786rwe; Sun, 16 Apr 2023 08:45:23 -0700 (PDT) X-Google-Smtp-Source: AKy350YPbBuhv6bX4CDt13THKLQ+L+8hNC5dH+YET7prGplSJQH1GQu6/HmRWL8oSMmRRDXpbQQw X-Received: by 2002:a17:90a:ab0e:b0:23d:35c9:bf1c with SMTP id m14-20020a17090aab0e00b0023d35c9bf1cmr12319909pjq.16.1681659922967; Sun, 16 Apr 2023 08:45:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681659922; cv=none; d=google.com; s=arc-20160816; b=ET3S9VIWROQIn8SHjcpxtxd4oM0P7wkB7vbFwjH0EcZcqEBlTFLMoyavOGL1CGpoCX rlDDtACNnUaJwbN8crQCCGadz2SgXEYpF3jiwQCS6dyCQVJKiSVg5rfzZ2x2ICb8oEf8 aeKXKilu37ZSwvTjMpm/lS+8NwnhclRG9FZ3kz52lSSwvqrg8kU/roWmJuCR6L7wpteK 06/LjENANaGnPNYKc82vhsvtZEJgjG6GxLPwR4ZQ62giO61Z/IsmpaZNDM8IVYthbf20 KtyTHv3CngXUj+QW89KHY3O5v2beiT7SqJ5lPsLK28QqHvTq/yuTSYttaU0rEj1OLJ6h sqLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=CwVfLHJ6BrHQq1wrP7gbBlF9u1FTFNbWwQPTdQvEmpM=; b=EpHWxhH9ANsSfU+OFt3FImj6BGkQYxMVP5ltxg9zLGs+tFF6DX0+cOgM4p29WNJCy5 IohTBep2kA3VtLWPXxsYKhAy6finspv5ZIDUeSWa0JRe6zw/r9Ldq6bdqQC2Lbyys93K hspI0e4FX43at4XK7LSV75nLKy3V8bW+8w8zerJjxPzsZ8BRN2MLNybFX84YiN+HB6OE 0pC+NzrYZeQmSRAGA+Dg1QX+w4dBnbCTlO+TJ9NBD3rAOkYp+MEFug3n9u8JdvrN55kJ eKLx9N/Q61vCyF5h9L6q744lXBJvxiKDRnBF+hToYk6Z0uVnE5k/Y5h9eD2YUfjot339 w2mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=opagxVVF; 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=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi19-20020a17090b1e5300b002477ddfa2f3si2501839pjb.182.2023.04.16.08.45.12; Sun, 16 Apr 2023 08:45:22 -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=@lunn.ch header.s=20171124 header.b=opagxVVF; 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=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbjDPPda (ORCPT + 99 others); Sun, 16 Apr 2023 11:33:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229836AbjDPPd2 (ORCPT ); Sun, 16 Apr 2023 11:33:28 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B764C2130; Sun, 16 Apr 2023 08:33:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=CwVfLHJ6BrHQq1wrP7gbBlF9u1FTFNbWwQPTdQvEmpM=; b=opagxVVFDY3vzkOFWWUQFuxXt8 OOqIF8zpJR8iBrhvxTQ3WNrD2WxTlfny62yVmD+2HpuoZoqXbsKV+DhHMhCoGFFVP8582yNnBFOXs jnnIEx9vTkOhFEvZjc/kr/uDytIgEsiJEjnbJkJW7G2u0AHg8K3pKxd46xwUgCFXY/tY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1po4NT-00AQxK-MU; Sun, 16 Apr 2023 17:33:19 +0200 Date: Sun, 16 Apr 2023 17:33:19 +0200 From: Andrew Lunn To: Wang Zhang Cc: Peter Korsgaard , Dongliang Mu , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] i2c: ocores: add missing unwind goto in `ocores_i2c_probe` Message-ID: <843fab4d-0fdd-4610-91ed-1d8e9accbd25@lunn.ch> References: <20230416072040.58373-1-silver_code@hust.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230416072040.58373-1-silver_code@hust.edu.cn> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Sun, Apr 16, 2023 at 03:20:40PM +0800, Wang Zhang wrote: > platform_get_irq_optional is a function used to obtain an IRQ > number for a device on a platform. The function returns the IRQ number > associated with the specified device, or a negative error code if it fails. > > 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. The clock is got in ocores_i2c_of_probe(). That function is not always called. So you need to be careful in the error handling that you are not disabling a clock which does not exist.... But i think a better fix is to change ocores_i2c_of_probe() to use devm_clk_get_enabled(), rather than devm_clk_get() so that the driver core will disable to clock if the probe fails, or when the driver is unloaded. Andrew