Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp275629pxb; Wed, 25 Aug 2021 03:01:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPFcyHPVyVIB9RHORGbxLstJTkxKJwGEcjb4uVU5X+JyctbVimEY3sj/r/Rgl8XNtlXpkT X-Received: by 2002:a17:906:ec9:: with SMTP id u9mr44165815eji.243.1629885698411; Wed, 25 Aug 2021 03:01:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629885698; cv=none; d=google.com; s=arc-20160816; b=VETdXQgpnavc3fZXWHHFq9Qcwmh3X6hyer/ELxeBFcEf4dAw+nHTbXlz+JJiqYEq0g G82XKH6iaBr2F6u7wu3M86RzunstZVobn1kSXp9p/JHQk509qsCAPmYZmPAuaxqj0Z6F CWcCjrJEHnRXI9w2U0pISuSnpkc6ECWDK3GWtlyrZ9UgrvHNK71rWBcernnz1ygFxJyY 4WHIRGc4qvXHdURurZTBsjWqtpVPK9MR3+zoGjuOitYh51iUwlzr8RyNw4OJYeZdpSh9 OSqlKGk8l4m3cHbH+t2tRCJ6i8Em035gbblPXeScMLErr4I/8uDFKr1ZgJ2GuTGm0LA0 A+Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=HTGwlETEEV1O0uBtm8Lgx0xPvfLsDplkfTQU44kCRJg=; b=WheG8y5HjZTBEUdTKZvUW05wCEYVA1ydtBKc8bpnigtrgzxsz2LxjA+UuBuch/DU3I mEdkQmVokAShtc4goxL7zf7W/gfmneoIIvpetnAlJwYaOq7Ww01p45NFh9fzhuuGjoII tgMteti0MNDWwLC4y25T4FCs4cexJuu36wVefJbMM56N+PI4C0lKwcLsuTNsc/YUp6Ko yBGmaMHvBNNuZBUN2nGG0zOeSYuDuZVFxxbGGJ0nawp+9Ode9o7dKITEPOsCgKNkeYyF FCHw/ns0TwblFp4SP2wIbdmLu7rOMz0InzslEFLK8HaJ6LOBNSz0it2a1fbobB6Lx2oY eZ7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si5922252edq.526.2021.08.25.03.01.15; Wed, 25 Aug 2021 03:01:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237357AbhHYJ6X (ORCPT + 99 others); Wed, 25 Aug 2021 05:58:23 -0400 Received: from mga12.intel.com ([192.55.52.136]:26549 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236997AbhHYJ6W (ORCPT ); Wed, 25 Aug 2021 05:58:22 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10086"; a="197062944" X-IronPort-AV: E=Sophos;i="5.84,350,1620716400"; d="scan'208";a="197062944" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.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 Subject: Re: [PATCH 2/3] drm/i915/selftests: Always initialize err in igt_dmabuf_import_same_driver_lmem() 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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