Re: [PATCH net-next v2 2/6] net: lan966x: add the basic lan966x driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux