Re: [kbuild] drivers/net/ethernet/mscc/ocelot_vsc7514.c:554 ocelot_xtr_irq_handler() error: uninitialized symbol 'err'.

From: Vladimir Oltean
Date: Fri Aug 27 2021 - 11:47:42 EST


On Fri, Aug 27, 2021 at 10:06:42AM +0300, Dan Carpenter wrote:
> static irqreturn_t ocelot_xtr_irq_handler(int irq, void *arg)
> {
> struct ocelot *ocelot = arg;
> int grp = 0, err;
>
> while (ocelot_read(ocelot, QS_XTR_DATA_PRESENT) & BIT(grp)) {
>
> Can this condition be false on the first iteration through the loop?

Functionally speaking, no, but if it helps anyone to initialize "err"
with 0, I guess we could...
>
> struct sk_buff *skb;
>
> err = ocelot_xtr_poll_frame(ocelot, grp, &skb);
> if (err)
> goto out;
>
> skb->dev->stats.rx_bytes += skb->len;
> skb->dev->stats.rx_packets++;
>
> if (!skb_defer_rx_timestamp(skb))
> netif_rx(skb);
> }
>
> out:
> if (err < 0)
> while (ocelot_read(ocelot, QS_XTR_DATA_PRESENT) & BIT(grp))
> ocelot_read_rix(ocelot, QS_XTR_RD, grp);
>
> return IRQ_HANDLED;
> }