From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Machek Subject: Re: [PATCH v3 net-next 03/11] net: dsa: microchip: Initialize mutex before use Date: Wed, 24 Oct 2018 13:07:51 +0200 Message-ID: <20181024110751.GA4864@amd> References: <1540261575-1889-1-git-send-email-Tristram.Ha@microchip.com> <1540261575-1889-4-git-send-email-Tristram.Ha@microchip.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YZ5djTAD1cGYuMQK" Cc: Andrew Lunn , Florian Fainelli , Ruediger Schmitt , Arkadi Sharshevsky , UNGLinuxDriver@microchip.com, netdev@vger.kernel.org To: Tristram.Ha@microchip.com Return-path: Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:52246 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726428AbeJXTfe (ORCPT ); Wed, 24 Oct 2018 15:35:34 -0400 Content-Disposition: inline In-Reply-To: <1540261575-1889-4-git-send-email-Tristram.Ha@microchip.com> Sender: netdev-owner@vger.kernel.org List-ID: --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon 2018-10-22 19:26:07, Tristram.Ha@microchip.com wrote: > From: Tristram Ha >=20 > Initialize mutex before use. >=20 > Signed-off-by: Tristram Ha > --- > drivers/net/dsa/microchip/ksz_common.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/mic= rochip/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; > =20 > - 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 =3D dev->pdata->chip_id; > =20 > + /* mutex is used in next function call. */ > + mutex_init(&dev->reg_mutex); > + > if (ksz_switch_detect(dev)) > return -EINVAL; Actually, would it make sense to move all mutex_init's there? No harm in doing them sooner... Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --YZ5djTAD1cGYuMQK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlvQUocACgkQMOfwapXb+vIrmQCggYztn+M/8iVoYcv+o3p9nVxV TxAAoKMgEMUz5scGd9AP3efItGmWPoUE =EfKl -----END PGP SIGNATURE----- --YZ5djTAD1cGYuMQK--