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 7F0D2C4338F for ; Wed, 25 Aug 2021 09:56:43 +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 2738360E97 for ; Wed, 25 Aug 2021 09:56:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2738360E97 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 9D51589A88; Wed, 25 Aug 2021 09:56:42 +0000 (UTC) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id C172B89A88; Wed, 25 Aug 2021 09:56:41 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10086"; a="281207781" X-IronPort-AV: E=Sophos;i="5.84,350,1620716400"; d="scan'208";a="281207781" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2021 02:56:41 -0700 X-IronPort-AV: E=Sophos;i="5.84,350,1620716400"; d="scan'208";a="426393046" 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:56:37 -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-2-nathan@kernel.org> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= Message-ID: Date: Wed, 25 Aug 2021 11:56:35 +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-2-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 1/3] drm/i915/selftests: Do not use import_obj uninitialized 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 a couple of times: > > drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:63:6: warning: > variable 'import_obj' is used uninitialized whenever 'if' condition is > true [-Wsometimes-uninitialized] > if (import != &obj->base) { > ^~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:80:22: note: > uninitialized use occurs here > i915_gem_object_put(import_obj); > ^~~~~~~~~~ > drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:63:2: note: remove > the 'if' if its condition is always false > if (import != &obj->base) { > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:38:46: note: > initialize the variable 'import_obj' to silence this warning > struct drm_i915_gem_object *obj, *import_obj; > ^ > = NULL > > Shuffle the import_obj initialization above these if statements so that > it is not used uninitialized. > > Fixes: d7b2cb380b3a ("drm/i915/gem: Correct the locking and pin pattern for dma-buf (v8)") > Reported-by: Dan Carpenter > Signed-off-by: Nathan Chancellor Patch looks good to me. Reviewed-by: Thomas Hellström