From: <Tristram.Ha@microchip.com>
To: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Pavel Machek <pavel@ucw.cz>,
Ruediger Schmitt <ruediger.schmitt@philips.com>
Cc: Tristram Ha <Tristram.Ha@microchip.com>,
Arkadi Sharshevsky <arkadis@mellanox.com>,
<UNGLinuxDriver@microchip.com>, <netdev@vger.kernel.org>
Subject: [PATCH v3 net-next 03/11] net: dsa: microchip: Initialize mutex before use
Date: Mon, 22 Oct 2018 19:26:07 -0700 [thread overview]
Message-ID: <1540261575-1889-4-git-send-email-Tristram.Ha@microchip.com> (raw)
In-Reply-To: <1540261575-1889-1-git-send-email-Tristram.Ha@microchip.com>
From: Tristram Ha <Tristram.Ha@microchip.com>
Initialize mutex before use.
Signed-off-by: Tristram Ha <Tristram.Ha@microchip.com>
---
drivers/net/dsa/microchip/ksz_common.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 8c5853e..88e8d2a 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -1118,7 +1118,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);
@@ -1207,6 +1206,9 @@ int ksz_switch_register(struct ksz_device *dev)
if (dev->pdata)
dev->chip_id = dev->pdata->chip_id;
+ /* mutex is used in next function call. */
+ mutex_init(&dev->reg_mutex);
+
if (ksz_switch_detect(dev))
return -EINVAL;
--
1.9.1
next prev parent reply other threads:[~2018-10-23 10:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-23 2:26 [PATCH v3 net-next 00/11] net: dsa: microchip: Modify KSZ9477 DSA driver in preparation to add other KSZ switch drivers Tristram.Ha
2018-10-23 2:26 ` [PATCH v3 net-next 01/11] net: dsa: microchip: Replace license with GPL Tristram.Ha
2018-10-24 11:05 ` Pavel Machek
2018-10-23 2:26 ` Tristram.Ha [this message]
2018-10-23 13:15 ` [PATCH v3 net-next 03/11] net: dsa: microchip: Initialize mutex before use Andrew Lunn
2018-10-24 11:07 ` Pavel Machek
2018-10-23 2:26 ` [PATCH v3 net-next 04/11] net: dsa: microchip: Rename some functions with ksz9477 prefix Tristram.Ha
2018-10-23 2:26 ` [PATCH v3 net-next 05/11] net: dsa: microchip: Rename ksz_spi.c to ksz9477_spi.c Tristram.Ha
2018-10-23 2:26 ` [PATCH v3 net-next 06/11] net: dsa: microchip: Break KSZ9477 DSA driver into two files Tristram.Ha
2018-10-23 2:26 ` [PATCH v3 net-next 07/11] net: dsa: microchip: Prepare PHY for proper advertisement Tristram.Ha
2018-10-23 2:26 ` [PATCH v3 net-next 08/11] net: dsa: microchip: Rename ksz_9477_reg.h to ksz9477_reg.h Tristram.Ha
2018-10-23 2:26 ` [PATCH v3 net-next 09/11] net: dsa: microchip: Add MIB counter reading support Tristram.Ha
2018-10-23 2:26 ` [PATCH v3 net-next 10/11] net: dsa: microchip: Modify tag_ksz.c so that tail tag code can be used by other KSZ switch drivers Tristram.Ha
2018-10-23 2:26 ` [PATCH v3 net-next 11/11] net: dsa: microchip: Add switch offload forwarding support Tristram.Ha
2018-10-23 3:26 ` [PATCH v3 net-next 00/11] net: dsa: microchip: Modify KSZ9477 DSA driver in preparation to add other KSZ switch drivers David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1540261575-1889-4-git-send-email-Tristram.Ha@microchip.com \
--to=tristram.ha@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=arkadis@mellanox.com \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=ruediger.schmitt@philips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).