Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp717233rwd; Thu, 25 May 2023 02:58:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7C0oe1k4lhoH919VLn/1B8IMaNEFdnKLCx45vYpDPbp8cgnx3Pq56y3BD4aFpTLk8PuOBb X-Received: by 2002:a05:6a20:c701:b0:103:b073:7a57 with SMTP id hi1-20020a056a20c70100b00103b0737a57mr20248983pzb.23.1685008727283; Thu, 25 May 2023 02:58:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685008727; cv=none; d=google.com; s=arc-20160816; b=wGLzeBBr6qZVf7Xy0YyAHPLjhYjDtAtmVnPleh5Ima6jcXIcIgPdCadjehfy1MV2hV P+6gRwIBVgsGR2UJJao6BSpxxY8vUZaC3nQk6T6vqQvUmuLPQzGQI71K+B5IhTRBMChv le7jPyHHHoG5d1S0pyBxp/+MuclrSRCUo/MaHnz4PB5iTdcSm0za4MKrw+65g6PDTJmN q9d7EU92CKu0PYChBxOsJ9MM8BJry81wBGdGJptRu7w23NKQBX2qmyOhzZfbxL3qASyN aisFssjXMNwZVFsNF84dv4g+l243QRbgrSzlvJv5yxwWbGIXEdZK3dYjq8PVsCFNEiEy cUYA== 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=gWtFhIZ8BYEBC241hJPMRaQ7fL223lARPk2xj1KRlLo=; b=FKIGmlDuALTYILOmtHRdjpHjcDYGNOyankscNQOyAW91FOcJR4wQyiB3ImL+CN++vH 4/LlUY4i/7tyCUaMoqfxRbg1tGF2xuzRHlB7sTcyWD7sV2MpFRIJRFg4RU1PMjwzFeaf AjgUtMCzaB7UNckqn88Eg8PTzRG2bejcpV+rTbH6H+E8lHGe9VeYgLY3byJAlxouSyqK w77C6s86OEYe8SLZRBXUPhtaQR/NGz8J2ajH/eYJcL+U0+G/z11+gwl0eZdOVFxqSyUQ Dh8f+Zu3RfYRMijCi5Rk7htv5reMplP4sxW2m7Wmn/uSlhMVEruiPCXdfzbafqqyZnVW gJSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ksHvc9/K"; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i64-20020a638743000000b00528948f640bsi849670pge.12.2023.05.25.02.58.35; Thu, 25 May 2023 02:58:47 -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=@linaro.org header.s=google header.b="ksHvc9/K"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239928AbjEYJ0l (ORCPT + 99 others); Thu, 25 May 2023 05:26:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240250AbjEYJ0g (ORCPT ); Thu, 25 May 2023 05:26:36 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E3A21B1 for ; Thu, 25 May 2023 02:26:33 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3094871953bso1298046f8f.0 for ; Thu, 25 May 2023 02:26:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685006791; x=1687598791; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=gWtFhIZ8BYEBC241hJPMRaQ7fL223lARPk2xj1KRlLo=; b=ksHvc9/KJc8tm8ddO3VFoE5QrlC2waPNIe++XS9LB0o0JrMFZAeIoo5XiRZa34k8Mm adRWW5BpbZbHCCZ3EfKxW0HYE3tT4/G8hy741p+ucGuludmSzf9ymx7MnxkL/zf+7rSJ zZmHTHyyj8cNdTrPatdM6xAghgwM5QEDXiAeZZ0A4pkSnLUpNuM5BqLfOm3e9Ax59b1A g61peEK9FWKDnhK9YTk3thi8hz/TKMgQ9vxK4+aCTDyZipQDPbMSqoz3Kgy8NnIZJRHg Ei3VYs3970BBcCQ860dc+3ztEEvJKCrvwNjWcK8FQBmJCWt4CM2nBqEfoHwU3vpiZ8Fe Tltg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685006791; x=1687598791; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=gWtFhIZ8BYEBC241hJPMRaQ7fL223lARPk2xj1KRlLo=; b=NoTNaMBv+uXeTycw0/qVcvvAy8s2ZbCvQCx8jmEU/lpw7eBb0pkTHfijrhzLLKarI1 ocR1IEOy3WIBtQihS1LErk86pHCE/5M55eVqt69tqEOXHArVhJADy5DCqhO0ppVKrW/l aGMc8C8auZD++E9AhVhUW5QgAoSV5gaXlxnJSl8eLZ6XjDHDSPWGwcF6f7Xu2Tokcamw eSiqolSQLPGWgIdslg6kUVZbpXIW1R2BKzgBw9qDFBeYY+O8SLBV445BZhsXIIw1Ici9 1ox0nrHgvbv4rkPL3yetxCncdeImT2G0dYdqCMIt2JItbVZntNusx82WAmz/tRq7SI4I Lfig== X-Gm-Message-State: AC+VfDzgS8DdG5qLvhb5yNnkT9j85r2VKtmEIOI88I42cDoeNkTtEVZx 3UZU6MgD6WZkUV+UZzH+u5xM1Q== X-Received: by 2002:adf:e550:0:b0:306:2fac:f88 with SMTP id z16-20020adfe550000000b003062fac0f88mr1828144wrm.28.1685006791750; Thu, 25 May 2023 02:26:31 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id o16-20020a5d58d0000000b002ffbf2213d4sm1139017wrf.75.2023.05.25.02.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 02:26:30 -0700 (PDT) Date: Thu, 25 May 2023 08:05:58 +0300 From: Dan Carpenter To: Christophe JAILLET Cc: Wang Zhang , Peter Korsgaard , Andrew Lunn , hust-os-kernel-patches@googlegroups.com, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] i2c: ocores: use devm_ managed clks Message-ID: <1b0de79d-87c9-46df-8b2f-f40bf58108c5@kili.mountain> References: <5572a733.abc0.18846f13b0b.Coremail.m202171703@hust.edu.cn> <20230524154318.2259-1-silver_code@hust.edu.cn> <68c4b991-6af9-36e8-354c-7c3b232ba4c2@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <68c4b991-6af9-36e8-354c-7c3b232ba4c2@wanadoo.fr> X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,DATE_IN_PAST_03_06, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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 Wed, May 24, 2023 at 09:21:56PM +0200, Christophe JAILLET wrote: > > + if (ret) { > > + dev_err(dev, > > + "clk_prepare_enable failed: %d\n", ret); > > + return ret; > > } > > + rate = clk_get_rate(i2c->clk) / 1000; > > Now (because of the devm_clk_get_optional_enabled()), i2c->clk can be NULL, > so this would deference a NULL pointer. > No, it's fine. clk_get_rate() checks for NULL. When a function returns a mix of error pointers and NULL, like devm_clk_get_optional_enabled(), then all the functions like this must have NULL checks built it. regards, dan carpenter