[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241112142014.044ec21c@kernel.org>
Date: Tue, 12 Nov 2024 14:20:14 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Divya Koppera <divya.koppera@...rochip.com>
Cc: <andrew@...n.ch>, <arun.ramadoss@...rochip.com>,
<UNGLinuxDriver@...rochip.com>, <hkallweit1@...il.com>,
<linux@...linux.org.uk>, <davem@...emloft.net>, <edumazet@...gle.com>,
<pabeni@...hat.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <richardcochran@...il.com>,
<vadim.fedorenko@...ux.dev>
Subject: Re: [PATCH net-next v3 2/5] net: phy: microchip_ptp : Add ptp
library for Microchip phys
On Tue, 12 Nov 2024 19:07:21 +0530 Divya Koppera wrote:
> + /* Iterate over all RX timestamps and match it with the received skbs */
> + spin_lock_irqsave(&ptp_clock->rx_ts_lock, flags);
> + list_for_each_entry_safe(rx_ts, tmp, &ptp_clock->rx_ts_list, list) {
> + /* Check if we found the signature we were looking for. */
> + if (skb_sig != rx_ts->seq_id)
> + continue;
> +
> + match = true;
> + break;
> + }
> + spin_unlock_irqrestore(&ptp_clock->rx_ts_lock, flags);
> +
> + if (match) {
> + shhwtstamps = skb_hwtstamps(skb);
> + shhwtstamps->hwtstamp = ktime_set(rx_ts->seconds, rx_ts->nsec);
> + netif_rx(skb);
> +
> + list_del(&rx_ts->list);
> + kfree(rx_ts);
> + } else {
> + skb_queue_tail(&ptp_clock->rx_queue, skb);
> + }
coccicheck complains that you are using rx_ts after the loop,
even though it's a loop iterator. Instead of using bool match
make that variable a pointer, set it to NULL and act on it only
if set. That will make the code easier for static checkers.
Coincidentally, I haven't looked closely, but you seem to have
a spin lock protecting the list, and yet you list_del() without
holding that spin lock? Sus.
--
pw-bot: cr
Powered by blists - more mailing lists