[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<AM0PR0402MB3891613D11CC97D5D5EEC80988E52@AM0PR0402MB3891.eurprd04.prod.outlook.com>
Date: Wed, 8 May 2024 02:41:22 +0000
From: Wei Fang <wei.fang@....com>
To: Eric Dumazet <edumazet@...gle.com>
CC: "davem@...emloft.net" <davem@...emloft.net>, "kuba@...nel.org"
<kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>, Shenwei Wang
<shenwei.wang@....com>, Clark Wang <xiaoning.wang@....com>,
"richardcochran@...il.com" <richardcochran@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"imx@...ts.linux.dev" <imx@...ts.linux.dev>
Subject: RE: [PATCH net-next] net: fec: Convert fec driver to use lock guards
> -----Original Message-----
> From: Eric Dumazet <edumazet@...gle.com>
> Sent: 2024年5月7日 18:40
> To: Wei Fang <wei.fang@....com>
> Cc: davem@...emloft.net; kuba@...nel.org; pabeni@...hat.com; Shenwei
> Wang <shenwei.wang@....com>; Clark Wang <xiaoning.wang@....com>;
> richardcochran@...il.com; netdev@...r.kernel.org;
> linux-kernel@...r.kernel.org; imx@...ts.linux.dev
> Subject: Re: [PATCH net-next] net: fec: Convert fec driver to use lock guards
>
> On Tue, May 7, 2024 at 11:16 AM Wei Fang <wei.fang@....com> wrote:
> >
> > Use guard() and scoped_guard() defined in linux/cleanup.h to automate
> > lock lifetime control in fec driver.
> >
> > Signed-off-by: Wei Fang <wei.fang@....com>
> >
>
> To me, this looks like a nice recipe for future disasters when doing backports,
> because I am pretty sure the "goto ..." that assumes the lock is magically
> released will fail horribly.
>
> I would use scoped_guard() only for new code.
Now that the kernel already supports scope-based resource management,
I think we should actively use this new mechanism. At least the result could
be safer resource management in the kernel and a lot fewer gotos.
Powered by blists - more mailing lists