From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD1DEC4338F for ; Wed, 25 Aug 2021 09:57:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A8B4161163 for ; Wed, 25 Aug 2021 09:57:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A8B4161163 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 135916E174; Wed, 25 Aug 2021 09:57:32 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9ABC989A88; Wed, 25 Aug 2021 09:57:30 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10086"; a="215648093" X-IronPort-AV: E=Sophos;i="5.84,350,1620716400"; d="scan'208";a="215648093" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2021 02:57:30 -0700 X-IronPort-AV: E=Sophos;i="5.84,350,1620716400"; d="scan'208";a="426393181" Received: from pjthomps-mobl1.ger.corp.intel.com (HELO [10.249.254.76]) ([10.249.254.76]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2021 02:57:26 -0700 To: Nathan Chancellor , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi Cc: Jason Ekstrand , Matthew Auld , "Michael J. Ruhl" , Nick Desaulniers , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, llvm@lists.linux.dev, Dan Carpenter References: <20210824225427.2065517-1-nathan@kernel.org> <20210824225427.2065517-3-nathan@kernel.org> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= Message-ID: <354f7760-7b43-8e3f-414b-1556dabbcdb3@linux.intel.com> Date: Wed, 25 Aug 2021 11:57:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210824225427.2065517-3-nathan@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Subject: Re: [Intel-gfx] [PATCH 2/3] drm/i915/selftests: Always initialize err in igt_dmabuf_import_same_driver_lmem() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 8/25/21 12:54 AM, Nathan Chancellor wrote: > Clang warns: > > drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:127:13: warning: > variable 'err' is used uninitialized whenever 'if' condition is false > [-Wsometimes-uninitialized] > } else if (PTR_ERR(import) != -EOPNOTSUPP) { > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:138:9: note: > uninitialized use occurs here > return err; > ^~~ > drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:127:9: note: remove > the 'if' if its condition is always true > } else if (PTR_ERR(import) != -EOPNOTSUPP) { > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:95:9: note: > initialize the variable 'err' to silence this warning > int err; > ^ > = 0 > > The test is expected to pass if i915_gem_prime_import() returns > -EOPNOTSUPP so initialize err to zero in this case. > > Fixes: cdb35d1ed6d2 ("drm/i915/gem: Migrate to system at dma-buf attach time (v7)") > Reported-by: Dan Carpenter > Signed-off-by: Nathan Chancellor Reviewed-by: Thomas Hellström