From patchwork Tue Nov 14 05:54:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 13454816 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E972FC0755A for ; Tue, 14 Nov 2023 05:55:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231512AbjKNFzJ (ORCPT ); Tue, 14 Nov 2023 00:55:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230200AbjKNFzI (ORCPT ); Tue, 14 Nov 2023 00:55:08 -0500 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4043F1BC; Mon, 13 Nov 2023 21:55:04 -0800 (PST) X-IronPort-AV: E=Sophos;i="6.03,301,1694703600"; d="scan'208";a="186678321" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 14 Nov 2023 14:55:02 +0900 Received: from localhost.localdomain (unknown [10.166.13.99]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 8F1734162940; Tue, 14 Nov 2023 14:55:02 +0900 (JST) From: Yoshihiro Shimoda To: lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, jingoohan1@gmail.com, gustavo.pimentel@synopsys.com, mani@kernel.org Cc: linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Justin Stitt , Nathan Chancellor , Yoshihiro Shimoda Subject: [PATCH v2 5/6] PCI: iproc: fix -Wvoid-pointer-to-enum-cast warning Date: Tue, 14 Nov 2023 14:54:55 +0900 Message-Id: <20231114055456.2231990-6-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231114055456.2231990-1-yoshihiro.shimoda.uh@renesas.com> References: <20231114055456.2231990-1-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Justin Stitt When building with clang 18 I see the following warning: | drivers/pci/controller/pcie-iproc-platform.c:55:15: warning: cast to smaller | integer type 'enum iproc_pcie_type' from 'const void *' [-Wvoid-pointer-to-enum-cast] | 55 | pcie->type = (enum iproc_pcie_type) of_device_get_match_data(dev); This is due to the fact that `of_device_get_match_data` returns a void* while `enum iproc_pcie_type` has the size of an int. This leads to truncation and possible data loss. Link: https://github.com/ClangBuiltLinux/linux/issues/1910 Reported-by: Nathan Chancellor Signed-off-by: Justin Stitt Signed-off-by: Yoshihiro Shimoda Reviewed-by: Geert Uytterhoeven Reviewed-by: Manivannan Sadhasivam --- drivers/pci/controller/pcie-iproc-platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-iproc-platform.c b/drivers/pci/controller/pcie-iproc-platform.c index acdc583d2980..83cbc95f4384 100644 --- a/drivers/pci/controller/pcie-iproc-platform.c +++ b/drivers/pci/controller/pcie-iproc-platform.c @@ -52,7 +52,7 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev) pcie = pci_host_bridge_priv(bridge); pcie->dev = dev; - pcie->type = (enum iproc_pcie_type) of_device_get_match_data(dev); + pcie->type = (uintptr_t) of_device_get_match_data(dev); ret = of_address_to_resource(np, 0, ®); if (ret < 0) {