[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <41774365-e247-4e32-9e96-d256acfcc129@intel.com>
Date: Mon, 29 Jan 2024 14:23:35 +0100
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: Alan Brady <alan.brady@...el.com>
CC: <intel-wired-lan@...ts.osuosl.org>, <netdev@...r.kernel.org>,
<willemdebruijn.kernel@...il.com>, <igor.bagnucki@...el.com>,
<przemyslaw.kitszel@...el.com>
Subject: Re: [Intel-wired-lan] [PATCH v2 0/7 iwl-next] idpf: refactor virtchnl
messages
From: Alan Brady <alan.brady@...el.com>
Date: Thu, 25 Jan 2024 21:47:40 -0800
> The motivation for this series has two primary goals. We want to enable
> support of multiple simultaneous messages and make the channel more
> robust. The way it works right now, the driver can only send and receive
> a single message at a time and if something goes really wrong, it can
> lead to data corruption and strange bugs.
[...]
There are a fistful of functions in this series and IDPF's virtchnl code
in general that allocate a memory chunk via kzalloc() family and then
free it at the end of the function, i.e. the lifetime of those buffers
are the lifetime of the function.
Since recently, we have auto-variables in the kernel, so that the pieces
I described could be converted to:
struct x *ptr __free(kfree) = NULL;
ptr = kzalloc(sizeof(*x), GPF_KERNEL);
// some code
return 0; // kfree() is not needed anymore
err:
return err; // here as well
That would allow to simplify the code and reduce its size.
I'd like you to convert such functions to use auto-variables.
Thanks,
Olek
Powered by blists - more mailing lists