[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211124081321.qbxhbbathz7nduuu@soft-dev3-1.localhost>
Date: Wed, 24 Nov 2021 09:13:21 +0100
From: Horatiu Vultur <horatiu.vultur@...rochip.com>
To: Denis Kirjanov <dkirjanov@...e.de>
CC: <davem@...emloft.net>, <kuba@...nel.org>, <robh+dt@...nel.org>,
<UNGLinuxDriver@...rochip.com>, <p.zabel@...gutronix.de>,
<linux@...linux.org.uk>, <netdev@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next v2 2/6] net: lan966x: add the basic lan966x
driver
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
Powered by blists - more mailing lists