Hi Andrew,

On Sat, Aug 10, 2019 at 07:32:24PM +0200, Andrew Lunn wrote:
> > @@ -596,11 +606,53 @@ static int ocelot_port_xmit(struct sk_buff *skb, 
> > struct net_device *dev)
> >  
> >     dev->stats.tx_packets++;
> >     dev->stats.tx_bytes += skb->len;
> > -   dev_kfree_skb_any(skb);
> > +
> > +   if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP &&
> > +       port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
> > +           struct ocelot_skb *oskb =
> > +                   kzalloc(sizeof(struct ocelot_skb), GFP_ATOMIC);
> > +
> > +           skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
> > +
> > +           oskb->skb = skb;
> 
> You have not checked if oskb == NULL. The allocation could of failed.

Will fix.

> > +   irq_ptp_rdy = platform_get_irq_byname(pdev, "ptp_rdy");
> > +   if (irq_ptp_rdy > 0) {
> 
> I wonder if this should be
> 
> > +   if (irq_ptp_rdy > 0 && ocelot->targets[PTP]) {
> 
> There is not much you can do in the PTP interrupt handler if you don't
> have the PTP registers. In fact, bad things might happen if it tried
> to handle such an interrupt.

That's right, the IRQ could be described and the register bank not. I'll
fix that.

> > +           err = devm_request_threaded_irq(&pdev->dev, irq_ptp_rdy, NULL,
> > +                                           ocelot_ptp_rdy_irq_handler,
> > +                                           IRQF_ONESHOT, "ptp ready",
> > +                                           ocelot);
> > +           if (err)
> > +                   return err;
> > +
> > +           /* Check if we can support PTP */
> > +           if (ocelot->targets[PTP])
> > +                   ocelot->ptp = 1;
> > +   }

Thanks!
Antoine

-- 
Antoine Ténart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Reply via email to