LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: Denis Kirjanov <dkirjanov@suse.de>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <robh+dt@kernel.org>,
	<UNGLinuxDriver@microchip.com>, <p.zabel@pengutronix.de>,
	<linux@armlinux.org.uk>, <netdev@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v2 2/6] net: lan966x: add the basic lan966x driver
Date: Wed, 24 Nov 2021 09:13:21 +0100	[thread overview]
Message-ID: <20211124081321.qbxhbbathz7nduuu@soft-dev3-1.localhost> (raw)
In-Reply-To: <16727fc4-4cc7-41de-910d-80b3bca70ef1@suse.de>

The 11/23/2021 18:31, Denis Kirjanov wrote:
> 
Hi Denis,

> > +static int lan966x_probe_port(struct lan966x *lan966x, u32 p,
> > +                           phy_interface_t phy_mode)
> > +{
> > +     struct lan966x_port *port;
> > +
> > +     if (p >= lan966x->num_phys_ports)
> > +             return -EINVAL;
> > +
> > +     port = devm_kzalloc(lan966x->dev, sizeof(*port), GFP_KERNEL);
> ENOMEM?

I will add this, even though the next patch in the series will change this.

> > +
> > +     port->lan966x = lan966x;
> > +     port->chip_port = p;
> > +     port->pvid = PORT_PVID;
> > +     lan966x->ports[p] = port;
> > +
> > +     return 0;
> > +}
> > +

...

> > +
> > +     /* go over the child nodes */
> > +     fwnode_for_each_available_child_node(ports, portnp) {
> > +             phy_interface_t phy_mode;
> > +             u32 p;
> > +
> > +             if (fwnode_property_read_u32(portnp, "reg", &p))
> > +                     continue;
> > +
> > +             phy_mode = fwnode_get_phy_mode(portnp);
> > +             err = lan966x_probe_port(lan966x, p, phy_mode);
> > +             if (err)
> > +                     return err;
> > +     }
> > +
> > +     return 0;
> You have to properly free allocated resource in the error case

Yes, I will need to call, fwnode_handle_put(portnp), like it is done in
the next patch.

> > +}
> > +
> > +static int lan966x_remove(struct platform_device *pdev)
> > +{
> > +     return 0;
> > +}
> > +
> > 

-- 
/Horatiu

  reply	other threads:[~2021-11-24  8:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23 13:55 [PATCH net-next v2 0/6] net: lan966x: Add lan966x switch driver Horatiu Vultur
2021-11-23 13:55 ` [PATCH net-next v2 1/6] dt-bindings: net: lan966x: Add lan966x-switch bindings Horatiu Vultur
2021-11-23 13:55 ` [PATCH net-next v2 2/6] net: lan966x: add the basic lan966x driver Horatiu Vultur
2021-11-23 15:31   ` Denis Kirjanov
2021-11-24  8:13     ` Horatiu Vultur [this message]
2021-11-24  3:30   ` Jakub Kicinski
2021-11-24  8:14     ` Horatiu Vultur
2021-11-23 13:55 ` [PATCH net-next v2 3/6] net: lan966x: add port module support Horatiu Vultur
2021-11-24 17:59   ` Andrew Lunn
2021-11-25  9:26     ` Horatiu Vultur
2021-11-25 14:59       ` Andrew Lunn
2021-11-26  9:12         ` Horatiu Vultur
2021-11-23 13:55 ` [PATCH net-next v2 4/6] net: lan966x: add mactable support Horatiu Vultur
2021-11-23 13:55 ` [PATCH net-next v2 5/6] net: lan966x: add ethtool configuration and statistics Horatiu Vultur
2021-11-23 13:55 ` [PATCH net-next v2 6/6] net: lan966x: Update MAINTAINERS to include lan966x driver Horatiu Vultur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211124081321.qbxhbbathz7nduuu@soft-dev3-1.localhost \
    --to=horatiu.vultur@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dkirjanov@suse.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --subject='Re: [PATCH net-next v2 2/6] net: lan966x: add the basic lan966x driver' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).