From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Tristram Ha <Tristram.Ha@microchip.com>,
"David S . Miller" <davem@davemloft.net>,
Sasha Levin <sashal@kernel.org>,
netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 06/27] net: dsa: microchip: initialize mutex before use
Date: Wed, 14 Nov 2018 17:24:55 -0500 [thread overview]
Message-ID: <20181114222520.99926-6-sashal@kernel.org> (raw)
In-Reply-To: <20181114222520.99926-1-sashal@kernel.org>
From: Tristram Ha <Tristram.Ha@microchip.com>
[ Upstream commit 284fb78ed7572117846f8e1d1d8e3dbfd16880c2 ]
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 <Tristram.Ha@microchip.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/microchip/ksz_common.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 56cd6d365352..6f4c9913f8f5 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -1104,11 +1104,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++) {
@@ -1193,6 +1188,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;
--
2.17.1
next prev parent reply other threads:[~2018-11-14 22:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20181114222520.99926-1-sashal@kernel.org>
2018-11-14 22:24 ` [PATCH AUTOSEL 4.14 02/27] netfilter: ipset: list:set: Decrease refcount synchronously on deletion and replace Sasha Levin
2018-11-14 22:24 ` [PATCH AUTOSEL 4.14 03/27] netfilter: ipset: actually allow allowable CIDR 0 in hash:net,port,net Sasha Levin
2018-11-14 22:24 ` [PATCH AUTOSEL 4.14 05/27] usbnet: smsc95xx: disable carrier check while suspending Sasha Levin
2018-11-14 22:24 ` Sasha Levin [this message]
2018-11-14 22:24 ` [PATCH AUTOSEL 4.14 07/27] net: systemport: Protect stop from timeout Sasha Levin
2018-11-14 22:24 ` [PATCH AUTOSEL 4.14 09/27] netfilter: xt_IDLETIMER: add sysfs filename checking routine Sasha Levin
2018-11-14 22:25 ` [PATCH AUTOSEL 4.14 11/27] mlxsw: spectrum: Fix IP2ME CPU policer configuration Sasha Levin
2018-11-14 22:25 ` [PATCH AUTOSEL 4.14 20/27] i40e: restore NETIF_F_GSO_IPXIP[46] to netdev features Sasha Levin
2018-11-14 22:25 ` [PATCH AUTOSEL 4.14 21/27] ibmvnic: fix accelerated VLAN handling Sasha Levin
2018-11-14 22:25 ` [PATCH AUTOSEL 4.14 22/27] qed: Fix memory/entry leak in qed_init_sp_request() Sasha Levin
2018-11-14 22:25 ` [PATCH AUTOSEL 4.14 23/27] qed: Fix blocking/unlimited SPQ entries leak Sasha Levin
2018-11-14 22:25 ` [PATCH AUTOSEL 4.14 24/27] qed: Fix potential memory corruption Sasha Levin
2018-11-14 22:25 ` [PATCH AUTOSEL 4.14 25/27] net: stmmac: Fix RX packet size > 8191 Sasha Levin
2018-11-14 22:25 ` [PATCH AUTOSEL 4.14 26/27] net: smsc95xx: Fix MTU range Sasha Levin
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=20181114222520.99926-6-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Tristram.Ha@microchip.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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).