Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp502287pxb; Thu, 9 Sep 2021 06:01:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN8OMlrdhB21ZwLkO1nONh2u3SpfKuGwy9OsfbK6YBj38dLDyRiS/+Beh68hgDitXuVLgs X-Received: by 2002:a05:6e02:17cb:: with SMTP id z11mr2255064ilu.68.1631192472099; Thu, 09 Sep 2021 06:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631192472; cv=none; d=google.com; s=arc-20160816; b=etw4DCvgxNPYnINWVoF1aWMauWDPdMsLhdLp5p2fwcyvxs7ff7LAe6sdSCzpGVNM2L vb75+1jxsxhul2/YMDRI0ClA+QjhgfLIMFfGvBIoUMEbirGViIp1LIzRj8gRXrmo3VLr bg9zJtYVLoXCBMbquXjap79b6uHNUmK60jFwgz4jv4YQYkZ9cRFrVO7LwQdDh7vXPTOj 8Jmc/fC8FFiZ13smTuPOS8HUvFBGJ53+Dxj2uzWanuCi1g39g6Yy8dXEsCJuOdjFMOxx aZo2g0QnneHX8ka/CJMn5i/FoOYJF6Eo+MC62ilvptsgqX/ZNTsCnywfcqGb/HEgezxn fHgA== 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=lBfuIK/2niLlt4QTTiJGzxMKkBazZGzspt/diGd6GQg=; b=RkFgBdLO5hTMpShTk1hhzjOCzmPPoK/bFHGoI7K7/yF90CQW8prfl8OLazXPs8AhZ4 kWgH89ALrVqTy6ir7lfBE8Fe5eHQktDl6lv8Z9DjvhvizH8YEIY9EKHJGUqoKIGcSc2z D80tFLxkBlMrKeX+oOAdQUq1YIeC9WRBMIpRkCtCXtqpyRxs9VIGZVbu1NCuqE8IvyVp 1sWP4T/B5yOaAWE15CqZC18uAh8onyvBaQcYXP2R6AMv5AHdFcmdN5MCwe7OU4/7LwIx fd4r2iEGPXBAVSMJf6TJb6CZ93p8EgjZHcSBb897T1oU7L050OiCWcGvSsmzho+wXnTA ZmBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oSdzFhim; 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 b125si1704782jab.33.2021.09.09.06.00.59; Thu, 09 Sep 2021 06:01:12 -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=oSdzFhim; 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 S1357392AbhIINAT (ORCPT + 99 others); Thu, 9 Sep 2021 09:00:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:40988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353445AbhIIMtJ (ORCPT ); Thu, 9 Sep 2021 08:49:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3C336613A3; Thu, 9 Sep 2021 11:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631188608; bh=QOZ5zytWglQA3/+3KXYARHhWSKqxTsAXNpce4qfrPMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oSdzFhimbbD+Ta8wuaAYihw/lVKidoGnMxQXIU2GVHWUQV3nJn37lTq8EQ2MsPy7M rnMAywK6YF7g6wFiicmRk6+0KblZrJpiA3KOeqtnnTKDeRE3kFb0q9sMZN2Szvd6hC eKfSEtI4Lm5LD4+869wo31Tcgx2fhFYIhHIsaz2CoibYNOkm9mCMm1w9pZKpYInUnu usMVEGFEN/Wvvs8tCkjJdYwpn2bhzoVIfvK/bKrdVrwXUyUlVE/lQE8VLMBg5s/hoT guLwMYilPf0jByLYs+yP/atuBL6fbv3jZCDOt30C9jAalfk3FmWnw0J+fJHnEV3TYq Tqjy47hZ+RDHg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nathan Chancellor , kernel test robot , Inki Dae , Sasha Levin , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH AUTOSEL 5.4 079/109] drm/exynos: Always initialize mapping in exynos_drm_register_dma() Date: Thu, 9 Sep 2021 07:54:36 -0400 Message-Id: <20210909115507.147917-79-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909115507.147917-1-sashal@kernel.org> References: <20210909115507.147917-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor [ Upstream commit c626f3864bbbb28bbe06476b0b497c1330aa4463 ] In certain randconfigs, clang warns: drivers/gpu/drm/exynos/exynos_drm_dma.c:121:19: warning: variable 'mapping' is uninitialized when used here [-Wuninitialized] priv->mapping = mapping; ^~~~~~~ drivers/gpu/drm/exynos/exynos_drm_dma.c:111:16: note: initialize the variable 'mapping' to silence this warning void *mapping; ^ = NULL 1 warning generated. This occurs when CONFIG_EXYNOS_IOMMU is enabled and both CONFIG_ARM_DMA_USE_IOMMU and CONFIG_IOMMU_DMA are disabled, which makes the code look like void *mapping; if (0) mapping = arm_iommu_create_mapping() else if (0) mapping = iommu_get_domain_for_dev() ... priv->mapping = mapping; Add an else branch that initializes mapping to the -ENODEV error pointer so that there is no more warning and the driver does not change during runtime. Reported-by: kernel test robot Signed-off-by: Nathan Chancellor Signed-off-by: Inki Dae Signed-off-by: Sasha Levin --- drivers/gpu/drm/exynos/exynos_drm_dma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c index 58b89ec11b0e..a3c9d8b9e1a1 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dma.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c @@ -140,6 +140,8 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev, EXYNOS_DEV_ADDR_START, EXYNOS_DEV_ADDR_SIZE); else if (IS_ENABLED(CONFIG_IOMMU_DMA)) mapping = iommu_get_domain_for_dev(priv->dma_dev); + else + mapping = ERR_PTR(-ENODEV); if (IS_ERR(mapping)) return PTR_ERR(mapping); -- 2.30.2