Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3121308pxb; Tue, 24 Aug 2021 15:56:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbszbED9VMQVN5zJCbXgTxrXcFa/aupV/p40qvMyACbAQYuJ117s8RCKV4/SVSN53N4HLZ X-Received: by 2002:a6b:b44f:: with SMTP id d76mr33472146iof.189.1629845796823; Tue, 24 Aug 2021 15:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629845796; cv=none; d=google.com; s=arc-20160816; b=lqUw/KRNalI2SiVSMMRZTT5eGvtoZvm8lpPo4o0tpbZXLtyd7i4O9DcQPAAplqKzzc TIEN+kbqvIx7VvpqTA8ZmEI5rsU6gcxxmBQsMnJ3byMaIYcVu9BaxV4HyNJjO1PjiJl5 RI7T1GZ7wsXWPqe8M0eivM/fRtl/we9TSpW4e3eQ6hEV+vY89KuMImZ2/Y5dMBjDTKdW ueIOe1sUgtlzeB7K1HX13GZSy75+MU65ZgA/4RwrCeGr1eIjT0+t21Ldd5NmyGHyeHSE IgaisZKF8hRqkZDcXiRINHwM7RhuQ4SKQoQ8+sXCl/5oQBwBlGQstoCGPI3NEi+s9Mfh hDIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Y94jD2sJjYx8WfPSZYTT5CdOA0JDNJ9Gnd8n5RoQmns=; b=XfJ+RLph2UmPxiwdEZHSeYTZTnUyW+NFz0kiS1TcBUlV9MLorAoK0aGdyu2pswoUMy 3EqAYz9dCMQoHVdZ5Yj0m3HScjyx1owFEjMPMvO2ujHmbwcDxoDoQu5MY+ktWxxiYO8f VAjAHXtv6ZYDyNniw/D5Zid5tonwdhAzjDt8tR1Sdti8toTdWu68hdQNSJDvQ8Mg03zI Wwl/xf1i6RV/f71iAxrfLlIKvpNQxtLsyC9HuPBjyB+CafvOJD+xcbYQoYA6UUUJDPc6 hpmvPE6QbqC03ZHkebTypOOJHTASadhqGPJDuy4cWqr9qnA5z3tMgppB9zNb0361OxNJ j3Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vIYXerym; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e4si7126767ios.62.2021.08.24.15.56.24; Tue, 24 Aug 2021 15:56:36 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vIYXerym; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233050AbhHXWzf (ORCPT + 99 others); Tue, 24 Aug 2021 18:55:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:49156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231842AbhHXWze (ORCPT ); Tue, 24 Aug 2021 18:55:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C9DBF61139; Tue, 24 Aug 2021 22:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629845689; bh=soYdqs0Qs7xCVvPch05cxgy1fyh2lip8GCF4qssf2PA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vIYXerymKENVREB2YJr0myqfiT+haL9C5Kk2wzNPhXo/BAjH8MM2i+/kGyW1v3jZr g5RZ8cCWNXVnFD2zQ4K53bgZbKVfygJ1UjrLWmHHQ0SHKYWG0WQyJgvCgIlbK7R0IB wROIp6NwWMuDFgWhdCjBpDIEw9ByiO4YoT/Yl2XiFNqd5bf+8N0UTyM/0UuiUPlTeD nsJu5bixEpR4ux0D3P2lqz9vPUVHFhU4QGT6GBI7XteNt7Cigab2BmWYYWv24hJ3w1 Y1RYNWAm52byXpxddb/K3PWdHwOC7SNUdm8Y2x6mBkv6z5RBWQCRejbbezXR9zHr6u yuast6MJAW/9w== From: Nathan Chancellor To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi Cc: Jason Ekstrand , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , 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, Nathan Chancellor , Dan Carpenter Subject: [PATCH 2/3] drm/i915/selftests: Always initialize err in igt_dmabuf_import_same_driver_lmem() Date: Tue, 24 Aug 2021 15:54:26 -0700 Message-Id: <20210824225427.2065517-3-nathan@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210824225427.2065517-1-nathan@kernel.org> References: <20210824225427.2065517-1-nathan@kernel.org> MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c index 532c7955b300..4a6bb64c3a35 100644 --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c @@ -128,6 +128,8 @@ static int igt_dmabuf_import_same_driver_lmem(void *arg) pr_err("i915_gem_prime_import failed with the wrong err=%ld\n", PTR_ERR(import)); err = PTR_ERR(import); + } else { + err = 0; } dma_buf_put(dmabuf); -- 2.33.0