Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp1671942qtg; Tue, 21 Mar 2023 20:17:13 -0700 (PDT) X-Google-Smtp-Source: AK7set9oWGJ9/ndr+yfXFX9799tTKaKuViq7BBBoOfKdDI/sPM8/JN4d5kPf16EMF5sbrlC+v7qh X-Received: by 2002:a17:906:6708:b0:933:4dc8:972d with SMTP id a8-20020a170906670800b009334dc8972dmr4912848ejp.20.1679455033532; Tue, 21 Mar 2023 20:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679455033; cv=none; d=google.com; s=arc-20160816; b=iB4U7/Cfvcv1dUcPihSIv2T2C72ajGh7ilAI/b0LYFbrXLoTOXv+njZN3yPOTYT+1m 3FJiLnmVslE8lZ4SdaBKvL3wtYhlFDdbxz2cD5JJgrRz8ecD3tRAfb3OpaErCCIso2v3 8zAaQDxUKN1tL35iLSsBjskkCEy8lE+wiK5IkI7SZ3VaZIe3aSnVMy3OBr0O+kn8A6aU Luar8Q3lp+eqUWlMAwZH0wYZUBsNg7HwOEcfapPMsdMaVflR9o8gfAgCeaf8CJmKQK6M Aw41V8Tx9KB8lDvc6Decwxf0RpRM/PH2N3d/aAwlZ+Xbivc7Q0t/wo2qqRMv0XCvs8V4 vD9Q== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=EjKCAgJg9cieJo4WyaQLchyUnbmOMCe6kLaI1IgAFZo=; b=WKtxGs/jsIkawfrYLKSLtnU7dQbF6K6vtlXeLQu6ydCH1M5DAqYhLfnUfcc+eKfqyb ilyZBTWuni1d/2UKNyi7DYDSA3W6YxBtM+7YkOaQPVmsUxcpETBlk+ijNcMzAiNy6hhh vwzLvV4F+gR61Ir4Fd03g18g5Mv0RCg1kcQJ9vMZiVO3v58d7ae3cQbG5BOE0SMpI/GG oFK2sk3GVxcplvj07yQ8W+R3syL/KgWqbGS6cKLuNhEwVuNSGzBFYQU/x65JnXfMjrBU fDGWI27f3eTNjL8+42bDAu+w2yA/KdqxNGjRdw2dV68fEC0+GLjo/Xu+OljTdDbEvzDF OJJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sbE8F39j; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020aa7ce0a000000b004fd3ad97e48si14114119edv.55.2023.03.21.20.16.48; Tue, 21 Mar 2023 20:17:13 -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=@kernel.org header.s=k20201202 header.b=sbE8F39j; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbjCVDKR (ORCPT + 99 others); Tue, 21 Mar 2023 23:10:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229584AbjCVDKQ (ORCPT ); Tue, 21 Mar 2023 23:10:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 822357DB6; Tue, 21 Mar 2023 20:10:15 -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 18EDA61E10; Wed, 22 Mar 2023 03:10:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDBFFC433D2; Wed, 22 Mar 2023 03:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679454614; bh=EoRmQVKZda3Kaw+obz4g6ex3TDnd9Bc2t7OczVEjfCQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=sbE8F39jhkQF29LF3KT9pV7+ZXD7mEcVIGSKn7k+vtdM9xqsGprUiiImBgUV+iJ0s i7znxBUSzFl8TrRk+NVDXgzUmK9uFL4aBex/0nwyMLnTzIr0PjZZ2y+hGCDlqGs/bg +SHnNvihZQsfwbtOqFG3CcMGl2dF58FC+6386YYQQFuIY6ZVAp+L9myfqTYk0K+0Wj qMmUnTThqDJ7AjAfPpqpG3zljkxpMn3YUuMhFwX3v0n2Y1wM3Iy/ryXEKzzl/X/Mc7 ULSyersgA14JPHO4dm8VPI0ZLMgEeALhMhE9biCrYubM+f5KxrTrx2/peuIW7YT8HZ efkJAzJ4/UVog== Date: Tue, 21 Mar 2023 20:10:12 -0700 From: Jakub Kicinski To: Sebastian Reichel Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Paolo Abeni , Maxime Coquelin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com Subject: Re: [PATCHv1 1/2] net: ethernet: stmmac: dwmac-rk: fix optional clock handling Message-ID: <20230321201012.74487996@kernel.org> In-Reply-To: <20230317174243.61500-2-sebastian.reichel@collabora.com> References: <20230317174243.61500-1-sebastian.reichel@collabora.com> <20230317174243.61500-2-sebastian.reichel@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 Fri, 17 Mar 2023 18:42:42 +0100 Sebastian Reichel wrote: > - bsp_priv->mac_clk_rx = devm_clk_get(dev, "mac_clk_rx"); > + bsp_priv->mac_clk_rx = devm_clk_get_optional(dev, "mac_clk_rx"); > if (IS_ERR(bsp_priv->mac_clk_rx)) > - dev_err(dev, "cannot get clock %s\n", > - "mac_clk_rx"); > + return dev_err_probe(dev, PTR_ERR(bsp_priv->mac_clk_rx), > + "cannot get clock %s\n", "mac_clk_rx"); > > - bsp_priv->mac_clk_tx = devm_clk_get(dev, "mac_clk_tx"); > + bsp_priv->mac_clk_tx = devm_clk_get_optional(dev, "mac_clk_tx"); > if (IS_ERR(bsp_priv->mac_clk_tx)) > - dev_err(dev, "cannot get clock %s\n", > - "mac_clk_tx"); > + return dev_err_probe(dev, PTR_ERR(bsp_priv->mac_clk_tx), > + "cannot get clock %s\n", "mac_clk_tx"); > > - bsp_priv->aclk_mac = devm_clk_get(dev, "aclk_mac"); > + bsp_priv->aclk_mac = devm_clk_get_optional(dev, "aclk_mac"); > if (IS_ERR(bsp_priv->aclk_mac)) > - dev_err(dev, "cannot get clock %s\n", > - "aclk_mac"); > + return dev_err_probe(dev, PTR_ERR(bsp_priv->aclk_mac), > + "cannot get clock %s\n", "aclk_mac"); Can we turn this into a loop struct { struct whatever **ptr; const char *name; } clocks[] = { { &bsp_priv->mac_clk_rx, "mac_clk_rx" }, { &bsp_priv->mac_clk_tx, "mac_clk_tx" }, ... } for (i=0; i < ARRAY_SIZE...) { *clocks[i]->ptr = devm_clk_get_optional(dev, clocks[i]->name); if (IS_ERR(*clocks[i]->ptr)) return dev_err_probe(dev, PTR_ERR(*clocks[i]->ptr), "cannot get clock %s\n", *clocks[i]->name); } ? Or alternatively inline the name of the clock into the error message? Right now the %s format printing looks neither here nor there, and also the continuation line is misaligned (should start right under "dev"). FWIW seems like it should be fine for net-next without the fixes tag.