[igt-dev] [PATCH 1/1] lib/vfs_file_max(): initialize static variable

Caz Yokoyama Caz.Yokoyama at intel.com
Tue Apr 16 15:55:40 UTC 2019


Drop.
Static is always initialized to 0, no need to explicitly initialize.
Thank you, Ashutosh.
-caz

On Tue, 2019-04-16 at 06:57 -0700, Caz Yokoyama wrote:
> I believe un-initialized static variable is most probably not zero.
> Correct me if I am wrong.
> 
> Signed-off-by: Caz Yokoyama <caz.yokoyama at intel.com>
> ---
>  lib/intel_os.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/intel_os.c b/lib/intel_os.c
> index dd93bea1..a4fe6b34 100644
> --- a/lib/intel_os.c
> +++ b/lib/intel_os.c
> @@ -281,7 +281,7 @@ void *intel_get_total_pinnable_mem(size_t *total)
>  
>  static uint64_t vfs_file_max(void)
>  {
> -	static long long unsigned max;
> +	static long long unsigned max = 0;
>  	if (max == 0) {
>  		FILE *file = fopen("/proc/sys/fs/file-max", "r");
>  		max = 80000;



More information about the igt-dev mailing list