From patchwork Tue Jul 27 23:36:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 487189 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=-19.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 5E2FBC4338F for ; Tue, 27 Jul 2021 23:37:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B5ED60F51 for ; Tue, 27 Jul 2021 23:37:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233412AbhG0XhF (ORCPT ); Tue, 27 Jul 2021 19:37:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:47544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232766AbhG0XhE (ORCPT ); Tue, 27 Jul 2021 19:37:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BE69C60F6B; Tue, 27 Jul 2021 23:37:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627429024; bh=7/A1ynyuGJxC2V55onFtTcT0S30N0yPSiFAcLSZd8cM=; h=From:To:Cc:Subject:Date:From; b=FibbjNdxtH5GDjWtsw/d7V7QPB0BQDBhsE1DjoVAsqbv+omdSiPX4vf5tbeuM7Bpl mHGMOYOM172j+aQbEYSQDwtZW2FnakYXO+YKWDKipaq5xN5QiPgPQ+fL0g5v/jDRKC xHmQpRY1ktas0Jz3/a4q28t9fzbYR+Z7hkVne7xtWwexehtohv8rqyn8+Pp0CJFZLa i8lB0TlbNUhpKVSDsODne7RWccG4jH64JUhEGuFr6c14jvQddsrW+bOmK5H7OPOTJQ i1B6hnarD9gYqcbLJoMTwS0MBEO8VQxcDtRDieC+k+0I8vuD06+Znp/+7PwwGdT5iT BPM9irdiQBVlw== From: Nathan Chancellor To: Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski Cc: Nick Desaulniers , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor , kernel test robot Subject: [PATCH] drm/exynos: Always initialize mapping in exynos_drm_register_dma() Date: Tue, 27 Jul 2021 16:36:56 -0700 Message-Id: <20210727233656.753002-1-nathan@kernel.org> X-Mailer: git-send-email 2.32.0.264.g75ae10bc75 MIME-Version: 1.0 X-Patchwork-Bot: notify Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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 --- drivers/gpu/drm/exynos/exynos_drm_dma.c | 2 ++ 1 file changed, 2 insertions(+) base-commit: 7d549995d4e0d99b68e8a7793a0d23da6fc40fe8 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);