net: dsa: microchip: initialize mutex before use
PATCH v2 1/1 net: dsa: microchip: initialize mutex before use
From: Tristram Ha <[email protected]>
Initialize mutex before use. Avoid kernel complaint when CONFIG_DEBUG_LOCK_ALLOC is enabled.
Fixes b987e98e50ab90e5 ("dsa: add DSA switch driver for Microchip KSZ9477")
Signed-off-by Tristram Ha <[email protected]>
Reviewed-by Pavel Machek <[email protected]>
Reviewed-by Andrew Lunn <[email protected]>
---
v2
- Add endorsements
v1
- Remove comment
drivers/net/dsa/microchip/ksz_common.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/dsa/microchip/ksz_common.c +5 -5
@@ -1117,11 +1117,6 @@ static int ksz_switch_init(struct ksz_device *dev) {int i; -mutex_init (&dev->reg_mutex); -mutex_init (&dev->stats_mutex); -mutex_init (&dev->alu_mutex); -mutex_init (&dev->vlan_mutex); - dev->ds->ops = &ksz_switch_ops;for (i =0 ; i <ARRAY_SIZE (ksz_switch_chips); i++) {
@@ -1206,6 +1201,11 @@ int ksz_switch_register(struct ksz_device *dev)if (dev->pdata) dev->chip_id = dev->pdata->chip_id; +mutex_init (&dev->reg_mutex); +mutex_init (&dev->stats_mutex); +mutex_init (&dev->alu_mutex); +mutex_init (&dev->vlan_mutex); +if (ksz_switch_detect (dev))return -EINVAL ;
Signature · 1 line
1.9.1
Quoted 9 lines · On 11/1/18 3:08 PM, [email protected] wrote:
From: Tristram Ha <[email protected]>
Initialize mutex before use. Avoid kernel complaint when
CONFIG_DEBUG_LOCK_ALLOCis enabled.Fixes b987e98e50ab90e5 ("dsa: add DSA switch driver for Microchip KSZ9477")Signed-off-by Tristram Ha <[email protected]>Reviewed-by Pavel Machek <[email protected]>Reviewed-by Andrew Lunn <[email protected]>
Reviewed-by Florian Fainelli <[email protected]>
Quoted 3 lines
---
v2
- Add endorsements
FWIW, David uses patchwork which automatically collects those tags into the patch whenver we reply with one of the recognized/supported tag. Thanks!
Signature · 1 line
Florian