Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp454431pxb; Thu, 9 Sep 2021 04:59:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXDqzeEkiD1Im0Ll3h+oDd8oqdXLvS2r/bgtIz/0U8BJmkDkkDJlW6so77+zTuQzovWkRc X-Received: by 2002:a17:906:a108:: with SMTP id t8mr3011862ejy.407.1631188779808; Thu, 09 Sep 2021 04:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631188779; cv=none; d=google.com; s=arc-20160816; b=JMwBYpWpTyGEckVYbT34NJjIscQQ91mPOjierNBlMkhVrQc1DFL7zo7Ia6Lqmqy9gi I6RKe2A7zFAie5xjWd1+/fSioQQuJXvM+jcr75X19bQkiseqg60O0lmEQnJz3HOpZgaP MI+CA5eUV5iPQonJjqbtBNy2FdF18upYNCrxuUisC+9CIREyaXwtVbTdepXlW52X0/PA ej9tFp9+oZDI3jsvx+AneR4xWBigrXtUV+CwyI5jdX78h5b0ncQK1Pb7qBAkDBg/SapX FIn8Q/poMtDRSi9FyPbRU+RjDlompqRZEBtaIC/Dp8AWeUcHhNM8qp1vitDLRw8QAUUb yVjA== 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=ANilVGfxonIIt2tXOAZKm5jIzhKYKwvd8t0JjkpV4D4=; b=O9WvECGd+KqkOB+h0uu2V2L84JKBHle0AISAxlBsu+hFSu+jDch6GUURkObWmN90wk hI4kDLdzgmd8hQh0XpEuUgRFxrPjYCyK8iiH+/UWHtZszMnb7sW7rDYIgbG1GaWq2xDM EztaYvDDfkqx5GsTNW8MvRyEBUG8qXznmhroTdE6OrtzCHT92k205X9ao2q602hoE1eQ PgG5UBZHvYQDw9z0wKaLHnWhpvJYrIf/ANJvuN5CYynvDc/X5mrdznsyvoin9dl3yEHL zSlu5p8Z8yzdWlKOsNIQFnXVWbtBOlE4Ij6cSpC2UZzNpMs07Arc8NqAEmdXeJ41aYKi aHjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qYXnSJ+E; 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 a25si1443320ejc.304.2021.09.09.04.59.14; Thu, 09 Sep 2021 04:59:39 -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=qYXnSJ+E; 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 S240435AbhIIL6g (ORCPT + 99 others); Thu, 9 Sep 2021 07:58:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:33232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245510AbhIILzD (ORCPT ); Thu, 9 Sep 2021 07:55:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 686F36138B; Thu, 9 Sep 2021 11:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187905; bh=76pG/1mTrO5PLLh788TwM7n8iSFCwidakWpyicrLVjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qYXnSJ+E7aRyp9oCxzY9WQQm0Ou3+oiW3UZbqUTcZpKok/1eI1hQff5E+N9I9LVxM QhbdPc4QO9EFiuPQMXkSV5x6k/lImPSnmR+Dawp9fx7JiHJY946QdPuroNyaMSkoD3 6heAm1tGH107hazDWg9GgoiFsnXkzFYcexy18cgzraqirD5GNgcDstb0RukaHUF3jm 0KHQNgb/3gX8wor5bvnrlyHBIWCZR9hsw114LIXDMvQMYmWuAw2pQCx9qj5eLckIvi j2W+QOUNN1yoXNezenanwBsxnK8e8mEEH9kJ7CR4Sd7WIFU56VXNeqdM9+34j8R9Pm BxPS42V91wzrw== 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.14 183/252] drm/exynos: Always initialize mapping in exynos_drm_register_dma() Date: Thu, 9 Sep 2021 07:39:57 -0400 Message-Id: <20210909114106.141462-183-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-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 0644936afee2..bf33c3084cb4 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dma.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c @@ -115,6 +115,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