From mboxrd@z Thu Jan 1 00:00:00 1970 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 D56ACC433F5 for ; Thu, 31 Mar 2022 16:28:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239951AbiCaQaM (ORCPT ); Thu, 31 Mar 2022 12:30:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233616AbiCaQaJ (ORCPT ); Thu, 31 Mar 2022 12:30:09 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 132262BE8; Thu, 31 Mar 2022 09:28:18 -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=f1Ud/0ViaYH+MGCkH++baXNjD1EX24kMqzHI2gaaGxs=; b=4lrScKXgukeKAmWs+GkIxg97+1 RHfXVnt0Y21w75FyV8jYpfj33s4RDYd83N/aDGv2lJJkoHqVK2gMYngzvSOXtxVwauOxw/NECZQ3O PHzD60K+KvU03fhchiCe7MXrM+N276i2uG4+ZiIUeTsPaCxjKvUDn83ls0ngzpUvx5pM=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nZxeT-00DUoA-L2; Thu, 31 Mar 2022 18:28:01 +0200 Date: Thu, 31 Mar 2022 18:28:01 +0200 From: Andrew Lunn To: Michael Walle Cc: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Alexandre Belloni , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC net-next 3/3] net: phy: mscc-miim: add support to set MDIO bus frequency Message-ID: References: <20220331151440.3643482-1-michael@walle.cc> <20220331151440.3643482-3-michael@walle.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220331151440.3643482-3-michael@walle.cc> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > @@ -295,21 +323,41 @@ static int mscc_miim_probe(struct platform_device *pdev) > if (!miim->info) > return -EINVAL; > > - ret = of_mdiobus_register(bus, pdev->dev.of_node); > + miim->clk = devm_clk_get_optional(&pdev->dev, NULL); > + if (IS_ERR(miim->clk)) > + return PTR_ERR(miim->clk); > + > + ret = clk_prepare_enable(miim->clk); > + if (ret) > + return ret; > + > + of_property_read_u32(np, "clock-frequency", &miim->clk_freq); The clock is optional if there is no "clock-frequency" property. If the property does exist, the clock should be mandatory. I don't think it should silently fail setting the bus frequency because the clock is missing. Andrew