lkml.org 
[lkml]   [2021]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v10 03/11] x86/cpufeatures: Add TDX Guest CPU feature
Date
On Wed, Oct 13 2021 at 12:42, Josh Poimboeuf wrote:
> On Wed, Oct 13, 2021 at 10:18:18AM +0200, Borislav Petkov wrote:
>> > +#include <asm/tdx.h>
>> > +
>> > +bool is_tdx_guest(void)
>> > +{
>> > + static int tdx_guest = -1;
>>
>> Put that one at the top of the file because such static variables do not
>> belong among the automatic function vars.
>
> I disagree, this prevents confusion and misuse by making it clear that
> the scope of the static variable is limited to this function.

I kinda agree under the assumption that a static variable is only used
in a particular context and there is a reasonable requirement to do so.

The above does not qualify as I pointed out in my other reply. Just
because it looks like strict local usage at the first glance does not
make an argument, really.

I'm amazed that it's so hard to see that this

use()
init()

pattern is broken to begin with.

So why are you arguing about the placement of this variable in the first
place instead of actually looking at the code, wondering about the
obscenity and then asking about the call ordering?

In case that I might miss something important here due to my lack of CS
education, please let me know.

Thanks,

tglx


\
 
 \ /
  Last update: 2021-10-14 01:19    [W:2.275 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site