From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH net] net: dsa: microchip: initialize mutex before use Date: Wed, 31 Oct 2018 02:21:52 +0100 Message-ID: <20181031012152.GE27873@lunn.ch> References: <1540943149-26832-1-git-send-email-Tristram.Ha@microchip.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "David S. Miller" , Florian Fainelli , Pavel Machek , UNGLinuxDriver@microchip.com, netdev@vger.kernel.org To: Tristram.Ha@microchip.com Return-path: Received: from vps0.lunn.ch ([185.16.172.187]:46787 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728880AbeJaKRu (ORCPT ); Wed, 31 Oct 2018 06:17:50 -0400 Content-Disposition: inline In-Reply-To: <1540943149-26832-1-git-send-email-Tristram.Ha@microchip.com> Sender: netdev-owner@vger.kernel.org List-ID: On Tue, Oct 30, 2018 at 04:45:49PM -0700, Tristram.Ha@microchip.com wrote: > From: Tristram Ha > > 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 > --- > drivers/net/dsa/microchip/ksz_common.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c > index 54e0ca6..f6f0662 100644 > --- a/drivers/net/dsa/microchip/ksz_common.c > +++ b/drivers/net/dsa/microchip/ksz_common.c > @@ -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,12 @@ 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); > + mutex_init(&dev->stats_mutex); > + mutex_init(&dev->alu_mutex); > + mutex_init(&dev->vlan_mutex); Hi Tristram The comment is no longer relevant now that all mutexes are initialised. Andrew