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 858BDC4332F for ; Thu, 10 Nov 2022 13:08:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230193AbiKJNII (ORCPT ); Thu, 10 Nov 2022 08:08:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230224AbiKJNIG (ORCPT ); Thu, 10 Nov 2022 08:08:06 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A721C42F for ; Thu, 10 Nov 2022 05:07:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668085624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8zMAudJpmdEKZtCKUy+05rwV5mHOrkDZJoA0XJ15CQ4=; b=TRNF16fIQg+6rv+ss24naYjUwi8Ge9/bk1EP0EyBLmbMXJPVyKWUaEZBjJ6mw+6GFweXJy Vo50vZSIY+LTYSXnLOWMeJamBmEcH3mod/u0eBh8eoqjeuxb3CA3RQfw7Xy5U/wnJTHyw1 KkYBDxPyKpzZXxksetqQIT95nmmHNLY= Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-67-z8CImxfyPo6leU4mJI23Yg-1; Thu, 10 Nov 2022 08:07:03 -0500 X-MC-Unique: z8CImxfyPo6leU4mJI23Yg-1 Received: by mail-pf1-f199.google.com with SMTP id cj8-20020a056a00298800b0056cee8a0cf8so1016640pfb.9 for ; Thu, 10 Nov 2022 05:07:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=8zMAudJpmdEKZtCKUy+05rwV5mHOrkDZJoA0XJ15CQ4=; b=zeizRCZFnk9VZ9T5iXmZnMEuvAlgdhplwRLAovy7LUzKsAuZ/TErm2gvzo0El4H3q5 K0Xp3txFrTal7wdoXoqdeSc0hd/QeTp6llc7uYXlfOpG+qv2XwoaTQ/BBJ9GLUPg+E5p UqeCTjZX7f+j4UMdRhjPuvrad847ep82gcapylPL3gP7eE8vLFwsXGX6BWtNEQMgNmAx 6n2gBMs+1wAem0azwFgsGaGgnSx7BuPjCnzwfDhtumaMYUo10+eUHlNrr85k4/dQqmKR CXWXVGeQgRv3DpQQJ9FuYiyeIIkZkC03nPEnkwz19MChii8BMyJT9coJS4kLuinJnQd9 MMgw== X-Gm-Message-State: ACrzQf3CFfnnTBxBJu3yHSwD9BH7DoGpLtSYrxMQB7A8hG0mcGzpbwm/ nqeQrJMZOx9uA8orRpbJ7D0gVUxh6buu6QPyh7cktxvnlEoxJZL+qWEe0rT63+QioQ5tcmL0awG tVde+ycqpbsvXnpCvpbNTbQ== X-Received: by 2002:a63:155b:0:b0:470:1a0b:ce3d with SMTP id 27-20020a63155b000000b004701a0bce3dmr34429941pgv.597.1668085621962; Thu, 10 Nov 2022 05:07:01 -0800 (PST) X-Google-Smtp-Source: AMsMyM4/ry76eNdJLG8wkw95+ZE+UZX4fN3mjnXvdaEyH+JPEN9B5VVng2ZratTCNQe1UctwEEQHtQ== X-Received: by 2002:a63:155b:0:b0:470:1a0b:ce3d with SMTP id 27-20020a63155b000000b004701a0bce3dmr34429912pgv.597.1668085621657; Thu, 10 Nov 2022 05:07:01 -0800 (PST) Received: from gerbillo.redhat.com (146-241-120-203.dyn.eolo.it. [146.241.120.203]) by smtp.gmail.com with ESMTPSA id lw5-20020a17090b180500b0020af2bab83fsm3081270pjb.23.2022.11.10.05.06.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 05:07:01 -0800 (PST) Message-ID: Subject: Re: [PATCH net-next v5 3/3] net: ethernet: ti: am65-cpsw: Add support for SERDES configuration From: Paolo Abeni To: Siddharth Vadapalli , davem@davemloft.net, edumazet@google.com, kuba@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski@linaro.org, krzysztof.kozlowski+dt@linaro.org, linux@armlinux.org.uk, vladimir.oltean@nxp.com, vigneshr@ti.com, nsekhar@ti.com Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, srk@ti.com Date: Thu, 10 Nov 2022 14:06:47 +0100 In-Reply-To: <20221109042203.375042-4-s-vadapalli@ti.com> References: <20221109042203.375042-1-s-vadapalli@ti.com> <20221109042203.375042-4-s-vadapalli@ti.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-2.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org hello, On Wed, 2022-11-09 at 09:52 +0530, Siddharth Vadapalli wrote: [...] > +static void am65_cpsw_disable_serdes_phy(struct am65_cpsw_common *common) > +{ > + struct device_node *node, *port_np; > + struct device *dev = common->dev; > + const char *name = "serdes-phy"; > + struct phy *phy; > + > + node = of_get_child_by_name(dev->of_node, "ethernet-ports"); > + > + for_each_child_of_node(node, port_np) { > + phy = devm_of_phy_get(dev, port_np, name); The above will try to allocate some memory and can fail. Even if the the following code will handle a NULL ptr, the phy will not be disabled. I think it's better if you cache the serdes phy ptr in am65_cpsw_init_serdes_phy() and you use such reference here, without resorting to devm_of_phy_get(). Cheers, Paolo