* [PATCH v3 net] net: systemport: Add error pointer checks in bcm_sysport_map_queues() and bcm_sysport_unmap_queues()
@ 2024-09-24 18:56 Dipendra Khadka
2024-09-25 11:18 ` Simon Horman
0 siblings, 1 reply; 3+ messages in thread
From: Dipendra Khadka @ 2024-09-24 18:56 UTC (permalink / raw)
To: florian.fainelli, bcm-kernel-feedback-list, davem, edumazet, kuba,
pabeni, f.fainelli, horms
Cc: Dipendra Khadka, netdev, linux-kernel
Add error pointer checks in bcm_sysport_map_queues() and
bcm_sysport_unmap_queues() after calling dsa_port_from_netdev().
Fixes: d156576362c0 ("net: systemport: Establish lower/upper queue mapping")
Fixes: da106a140f9c ("net: systemport: Unmap queues upon DSA unregister event")
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
---
v3:
- Updated patch subject
- Updated patch description
- Added Fixes: tags
- Fixed typo from PRT_ERR to PTR_ERR
- Error is checked just after assignment
v2: https://lore.kernel.org/all/20240923053900.1310-1-kdipendra88@gmail.com/
- Change the subject of the patch to net
v1: https://lore.kernel.org/all/20240922181739.50056-1-kdipendra88@gmail.com/
drivers/net/ethernet/broadcom/bcmsysport.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index c9faa8540859..493702fdabc3 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2331,11 +2331,15 @@ static const struct net_device_ops bcm_sysport_netdev_ops = {
static int bcm_sysport_map_queues(struct net_device *dev,
struct net_device *slave_dev)
{
- struct dsa_port *dp = dsa_port_from_netdev(slave_dev);
struct bcm_sysport_priv *priv = netdev_priv(dev);
struct bcm_sysport_tx_ring *ring;
unsigned int num_tx_queues;
unsigned int q, qp, port;
+ struct dsa_port *dp;
+
+ dp = dsa_port_from_netdev(slave_dev);
+ if (IS_ERR(dp))
+ return PTR_ERR(dp);
/* We can't be setting up queue inspection for non directly attached
* switches
@@ -2386,11 +2390,15 @@ static int bcm_sysport_map_queues(struct net_device *dev,
static int bcm_sysport_unmap_queues(struct net_device *dev,
struct net_device *slave_dev)
{
- struct dsa_port *dp = dsa_port_from_netdev(slave_dev);
struct bcm_sysport_priv *priv = netdev_priv(dev);
struct bcm_sysport_tx_ring *ring;
unsigned int num_tx_queues;
unsigned int q, qp, port;
+ struct dsa_port *dp;
+
+ dp = dsa_port_from_netdev(slave_dev);
+ if (IS_ERR(dp))
+ return PTR_ERR(dp);
port = dp->index;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3 net] net: systemport: Add error pointer checks in bcm_sysport_map_queues() and bcm_sysport_unmap_queues()
2024-09-24 18:56 [PATCH v3 net] net: systemport: Add error pointer checks in bcm_sysport_map_queues() and bcm_sysport_unmap_queues() Dipendra Khadka
@ 2024-09-25 11:18 ` Simon Horman
2024-09-25 15:37 ` Dipendra Khadka
0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2024-09-25 11:18 UTC (permalink / raw)
To: Dipendra Khadka
Cc: florian.fainelli, bcm-kernel-feedback-list, davem, edumazet, kuba,
pabeni, f.fainelli, netdev, linux-kernel
On Tue, Sep 24, 2024 at 06:56:33PM +0000, Dipendra Khadka wrote:
> Add error pointer checks in bcm_sysport_map_queues() and
> bcm_sysport_unmap_queues() after calling dsa_port_from_netdev().
>
> Fixes: d156576362c0 ("net: systemport: Establish lower/upper queue mapping")
> Fixes: da106a140f9c ("net: systemport: Unmap queues upon DSA unregister event")
> Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
I'm sorry to be picky, but I think the fixes tag should be (only):
Fixes: 1593cd40d785 ("net: systemport: use standard netdevice notifier to detect DSA presence")
Otherwise, this looks good to me.
...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3 net] net: systemport: Add error pointer checks in bcm_sysport_map_queues() and bcm_sysport_unmap_queues()
2024-09-25 11:18 ` Simon Horman
@ 2024-09-25 15:37 ` Dipendra Khadka
0 siblings, 0 replies; 3+ messages in thread
From: Dipendra Khadka @ 2024-09-25 15:37 UTC (permalink / raw)
To: Simon Horman
Cc: florian.fainelli, bcm-kernel-feedback-list, davem, edumazet, kuba,
pabeni, f.fainelli, netdev, linux-kernel
Hi Simon,
On Wed, 25 Sept 2024 at 17:04, Simon Horman <horms@kernel.org> wrote:
>
> On Tue, Sep 24, 2024 at 06:56:33PM +0000, Dipendra Khadka wrote:
> > Add error pointer checks in bcm_sysport_map_queues() and
> > bcm_sysport_unmap_queues() after calling dsa_port_from_netdev().
> >
> > Fixes: d156576362c0 ("net: systemport: Establish lower/upper queue mapping")
> > Fixes: da106a140f9c ("net: systemport: Unmap queues upon DSA unregister event")
> > Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
>
> I'm sorry to be picky, but I think the fixes tag should be (only):
>
> Fixes: 1593cd40d785 ("net: systemport: use standard netdevice notifier to detect DSA presence")
>
I have sent the v4 patch. I was checking git log -S 'function name
like bcm_sysport_map_queues'. But when I checked with the
"dsa_port_from_netdev", I got the same result as yours.Thank you once
again.
> Otherwise, this looks good to me.
>
> ...
Best regards,
Dipendra Khadka
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-25 15:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-24 18:56 [PATCH v3 net] net: systemport: Add error pointer checks in bcm_sysport_map_queues() and bcm_sysport_unmap_queues() Dipendra Khadka
2024-09-25 11:18 ` Simon Horman
2024-09-25 15:37 ` Dipendra Khadka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).