[RFC Patch net-next v3 1/3] net: dsa: microchip: use dev_ops->reset instead of exit in ksz_switch_register
From: Arun Ramadoss
Date: Tue Aug 30 2022 - 06:53:38 EST
ksz8_switch_exit, ksz9477_switch_exit and lan937x_switch_exit functions
all call the reset function which is assigned to dev_ops->reset hooks.
So instead of calling the dev_ops->exit in ksz_switch_register during
the error condition of dsa_register_switch, dev_ops->reset is used now.
The dev_ops->exit can be extended in lan937x for freeing up the irq
during the ksz_spi_remove. If we add the irq remove in the exit function
and it is called during the dsa_switch_register error condition, kernel
panic happens since irq is setup only in setup operation. To avoid the
kernel panic, dev_ops->reset is used instead of exit.
Signed-off-by: Arun Ramadoss <arun.ramadoss@xxxxxxxxxxxxx>
---
drivers/net/dsa/microchip/ksz_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 6bd69a7e6809..da9bdf753f7a 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -1963,7 +1963,7 @@ int ksz_switch_register(struct ksz_device *dev)
ret = dsa_register_switch(dev->ds);
if (ret) {
- dev->dev_ops->exit(dev);
+ dev->dev_ops->reset(dev);
return ret;
}
--
2.36.1