Subject: lock/unlock asymmetry
To: None <tech-kern@netbsd.org>
From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
List: tech-kern
Date: 07/08/2007 01:32:10
--=-=-=
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,

maybe it's the late hour, and I don't understand locks anyway, but...

Looking at the interrupt routines in sys/dev/ic/z8530sc.c, it seems to
me that the code unlocks channel A twice, and never unlocks
channel B:


int
zsc_intr_hard(arg)
	void *arg;
{
	struct zsc_softc *zsc =3D arg;
	struct zs_chanstate *cs;
	u_char rr3;

	/* First look at channel A. */
	cs =3D zsc->zsc_cs[0];

	/* Lock both channels */
	simple_lock(&cs->cs_lock);
	simple_lock(&zsc->zsc_cs[1]->cs_lock);


        [ ...do stuff with channel A ]


	/* Done with channel A */
	simple_unlock(&cs->cs_lock);

	/* Now look at channel B. */


        [ ...do stuff with channel B ]


	simple_unlock(&cs->cs_lock);

	/* Note: caller will check cs_x->cs_softreq and DTRT. */
	return (rr3);
}


=2D- anything I missed? That code has been around for a while, after
all...

        hauke=20
=20
=2D-=20
Hauke Fath				Telefon 06155/667161
Friedrich-Ebert-Stra=DFe 70
64347 Griesheim
Germany

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (NetBSD)

iQEVAwUARpAipUlvHWuQ030JAQLGHgf8DPqzyr/3efHRfQAI8rxVbYnBKTeJ4oj9
g7ISXnlSXx7xZiOS1WyL9DR8iCjO2PI9DskyqQXJHMWSlTK72nKD5gr0BK3v00zj
guhWCMabOacP/0csr3FbZ7rm4eUJhRoz6YyJJ+XXe9a8LkKpy8/y+qLoW+yqhVo3
6YiImbxiUyAxCiG7W0qoeKiT8/U/b2i5OPFD2Jjxox+x2318QkSPBNtqtALWob6N
c+IYY08PsKifuFlvSqLXeyk+n/TriRprSaPJCP5ANlr1LKaLIFpicWxDjU/HKAaB
TYKbdzv39cttDvDgfWa0Ko//IyCDgzPJUkPFI/hiP6RI83B4yWVawg==
=0xDh
-----END PGP SIGNATURE-----
--=-=-=--