Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2195659rdf; Mon, 6 Nov 2023 07:21:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IElDVpc5UAVX67nbPjpW3kyweMlahaaeKl2YdP+zkzjBT6qHIlAoo2qXrweRFh211LzEEZW X-Received: by 2002:a92:7613:0:b0:359:42b0:cb01 with SMTP id r19-20020a927613000000b0035942b0cb01mr16737569ilc.19.1699284096836; Mon, 06 Nov 2023 07:21:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699284096; cv=none; d=google.com; s=arc-20160816; b=NkQYpEeLh+S9x7oH4j9/2il7ZieVkZcmXLmtsBWbnDqKLG4SPGySbsS1c5eU6xWpDI gV7Jt8sr+uXyX7Il2KF5yLdpfp2EMJ5sAvseKmyHrm24VRwlkUy7bckoE5MEc+h/tY4r UrKoTYUOKeYuSMDL8eJPPFTKAFwJQUg2r1UQYs6lIxeBynmVQaVEcQpg/bC85d1BGeMh dxfhcrJUW62YHIMqAzAUWaLPau/SKLACXM1Zf/Lrje70koazxeZ8sBwxqaGglc66UBsz 4Y0yZPuSv18zdV6h6Zs2fnAyV0nEcqQTTtIaM73IODkAMmZtvxfcBHg1blXbJiGGjs/K L6sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=P92lxDHD1C4zCfjkheHzuT5lqonsPzQbwvZLdTTLERo=; fh=GvVjh7aafKWfnmuAZses8e2QksAi5YyVxbbP0zD/9JI=; b=ZtUp92pEKf1+8BA13lzkSt+1lzDgaYDUAZR3l2uSxEx8DKqBo1QG58/NcsUImAzZEh d262jpZj7D3NnNDXM6L6DniWcv0HFTcDU8EH31fNxzRJR4M7BneaGNmD4JUV+Ha0Ev0p gqp0Enj56xkoLsG8CU9TOzWtiVegOoEvkgHNdSccgICi2Nv3AS3wt/RFkBJtY+zZy/+B f9Ag1ysxxMhavzvX0ChTzUcJyOLxkP7DsdCqY9Oo3YgEn3JpcBWZ9iOCbHSDEgznn8U9 ZhsROJNokioOpxbk7NuuXmugD4NzK69B2CTrEB1K4fOzAv7NLOUxlydxjNj4gNUDxjBx TcBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="lC8n6Gk/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id a20-20020a656054000000b005b96fc78ef3si8580721pgp.231.2023.11.06.07.21.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:21:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="lC8n6Gk/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5176D803FC30; Mon, 6 Nov 2023 07:21:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231516AbjKFPVT (ORCPT + 99 others); Mon, 6 Nov 2023 10:21:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbjKFPVS (ORCPT ); Mon, 6 Nov 2023 10:21:18 -0500 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9059EB3 for ; Mon, 6 Nov 2023 07:21:15 -0800 (PST) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6bd20c30831so817105b3a.1 for ; Mon, 06 Nov 2023 07:21:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699284075; x=1699888875; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=P92lxDHD1C4zCfjkheHzuT5lqonsPzQbwvZLdTTLERo=; b=lC8n6Gk/9IK2XkD5aQvP3ZAZsMZsX+9tHQ/AgGyiOSR9mv/RsyHL0cLdP7i7m4yKzt 4pNqJdq296OO+fl/IIo8xv1qYoGa8x25CF84AdTsSjrx6/XbB8gu4qilzkIa6IlYSEVK kHy45kJRnYIymVpHTuUOvkJDEAZ/w3DiuuvYVmYxmzZZ7RrIIG97rCHhGjOmGq6fhtWj huH9W2duRgpLM0arH0SSGpr/zCEEuVC1P+/CgbJ93lDriHb6tGJUJTBOkGZd0EpNqypD KEf5NFU7PL51peZtyQwR5qFKmsTapXHVeso8K3a4ZtVc/zHsu7Fjp/V5qYsTmrjhFvhc 49Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699284075; x=1699888875; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=P92lxDHD1C4zCfjkheHzuT5lqonsPzQbwvZLdTTLERo=; b=B8HbZDTZ6qjd1jDfUZbGVlKY60KlHU9JIXzL2yyAFCuaLWU/rCPZR/HkjPAOfcGMMX /1ZzY/1SfLl6X4Pjb6hkLGrTeUCS2n6+GjLMgissWfzVAvnhWT9j2zkvSlJ7e0XO8OfG 5JNuNon98+Glgu5+hLgQp6qxMm86RxKW/ksM4qVcAhpxyTfUPo1PNuq6Pmk6IBz7CgOk Mtu4N6WNJA90qXy0Qcj6iQJYRfEvIirZJnsPnHBAtvKotmgyhhDC05FcJvQFCt6OSX7T i/3GGg74Rif6BjalbzH3cc3fPAX5C9xRVlUQnGjqCRMzw+YAhjm+NUqhVfkImfoYJOlY j83g== X-Gm-Message-State: AOJu0YxqwBgAC0TYSBRWMvOLoayTbcoOd4urBKCXFXIkTPYkR73AQeH/ V86u1xyKTRS3qC1yhCtK+3/BgCz9Vx1J+cVO X-Received: by 2002:a05:6a00:470a:b0:68f:c8b3:3077 with SMTP id df10-20020a056a00470a00b0068fc8b33077mr28116172pfb.1.1699284074970; Mon, 06 Nov 2023 07:21:14 -0800 (PST) Received: from [192.168.0.152] ([103.75.161.211]) by smtp.gmail.com with ESMTPSA id n35-20020a056a000d6300b006b90f1706f1sm5777285pfv.134.2023.11.06.07.21.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Nov 2023 07:21:14 -0800 (PST) Message-ID: Date: Mon, 6 Nov 2023 20:51:03 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL To: Jani Nikula , alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch Cc: linux-kernel-mentees@lists.linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20231103155013.332367-1-singhabhinav9051571833@gmail.com> <87sf5jyvkt.fsf@intel.com> Content-Language: en-US From: Abhinav Singh In-Reply-To: <87sf5jyvkt.fsf@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 06 Nov 2023 07:21:34 -0800 (PST) On 11/6/23 16:53, Jani Nikula wrote: > On Fri, 03 Nov 2023, Abhinav Singh wrote: >> sparse static analysis tools generate a warning with this message >> "Using plain integer as NULL pointer". In this case this warning is >> being shown because we are trying to intialize a pointer to NULL using >> integer value 0. >> >> Signed-off-by: Abhinav Singh >> --- >> drivers/gpu/drm/radeon/clearstate_evergreen.h | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/gpu/drm/radeon/clearstate_evergreen.h b/drivers/gpu/drm/radeon/clearstate_evergreen.h >> index 63a1ffbb3ced..3b645558f133 100644 >> --- a/drivers/gpu/drm/radeon/clearstate_evergreen.h >> +++ b/drivers/gpu/drm/radeon/clearstate_evergreen.h >> @@ -1049,7 +1049,7 @@ static const struct cs_extent_def SECT_CONTEXT_defs[] = >> {SECT_CONTEXT_def_5, 0x0000a29e, 5 }, >> {SECT_CONTEXT_def_6, 0x0000a2a5, 56 }, >> {SECT_CONTEXT_def_7, 0x0000a2de, 290 }, >> - { 0, 0, 0 } >> + { NULL, 0, 0 } > > Random drive-by comment: > > I'd just use {} as the sentinel. > > BR, > Jani. > >> }; >> static const u32 SECT_CLEAR_def_1[] = >> { >> @@ -1060,7 +1060,7 @@ static const u32 SECT_CLEAR_def_1[] = >> static const struct cs_extent_def SECT_CLEAR_defs[] = >> { >> {SECT_CLEAR_def_1, 0x0000ffc0, 3 }, >> - { 0, 0, 0 } >> + { NULL, 0, 0 } >> }; >> static const u32 SECT_CTRLCONST_def_1[] = >> { >> @@ -1070,11 +1070,11 @@ static const u32 SECT_CTRLCONST_def_1[] = >> static const struct cs_extent_def SECT_CTRLCONST_defs[] = >> { >> {SECT_CTRLCONST_def_1, 0x0000f3fc, 2 }, >> - { 0, 0, 0 } >> + { NULL, 0, 0 } >> }; >> static const struct cs_section_def evergreen_cs_data[] = { >> { SECT_CONTEXT_defs, SECT_CONTEXT }, >> { SECT_CLEAR_defs, SECT_CLEAR }, >> { SECT_CTRLCONST_defs, SECT_CTRLCONST }, >> - { 0, SECT_NONE } >> + { NULL, SECT_NONE } >> }; >> -- >> 2.39.2 >> > Hi, Thanks for dropping by and the suggestion. I thought of using NULL instead of {} is because, first the warning itself says that 0 is used to intialize pointers with NULL, and second due this link https://www.spinics.net/lists/linux-sparse/msg10066.html where linus is talking about not using 0 NULL intialization of pointer variable and he thinks this is a legitimate issue and not some false positive