Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp1997673rdb; Thu, 17 Aug 2023 08:01:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2MxFYXNly97+XqkGgbqx5Zm08/rYLgM1TVx8Dz0o5BVlx6gewnbsL7xnJ75w9j9D7LDvx X-Received: by 2002:ac2:5f96:0:b0:4fb:9d61:db44 with SMTP id r22-20020ac25f96000000b004fb9d61db44mr3972628lfe.12.1692284466974; Thu, 17 Aug 2023 08:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692284466; cv=none; d=google.com; s=arc-20160816; b=RRRvz7iYoJIPSm2ERTXZZCai4Cg96knZcvHAARkx+a96G2szq8r64rfJYBPVZgGuoC rxbeulQm3gOjtTfwrlsF8CvOrNVnstMz3jEZnmucLn7Tke3W4EZC3EruTDKqlD1T3EeQ cs2GJl4I6+ihFXZu9Z+LQnKpA7ofPcIerLY75Upy6sJOuVolmH/D7dYRlxc2mSRshcZu T8mXSq5IbT3wLlO+R5i8ZnYXv2V+CeF6OdGgFvMXHZ2F7fNNOPufMCxzqfhUbw9l6Osh AbK5UDDFdfNbR5bNfk0vx3hb0eAzRIxuoPpZba2dLNmM/20153tm0D1sK/kPN4Z2gOmK r3yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=vPIRm+r2j/XGNQXmGb4kJZdwIiaYA0yFVuKELbN9uLA=; fh=J2E72PBeKzdm0zKYSFTA4H9DtWvIQZyjBFR22dgBip4=; b=ofi4ozbgYNT4pBazTZUckvcEJuw16hvrJ+QEZ/XY0XEfkAMOzAv+aGOjPgjOwgN5mP y68qr2JTQLBdWtyfeuMQjFpcu+mbF6cfdgg8Vtc8wX4AUvJgYiY/9g2+F7u5KwJEfsVI 1Xm519EpYls5/a7u/PqhVsSdDC4eVe83vKN84WvgyP/Py705XjbvWKIV5cAkCvoBvFM0 n04keb8lffxQlKjwrMTBkE81Wh6RzGps8/08+c8RP6Li4b5wFsCHBZ+by6zAmAgVzACr dWWVu61oRZLJ3dTW+M31sviogjcNVXa6e7P82vGke3UyMszVmdLJjC7uqiOnpqzDQIao nttA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=oyNmb5IZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q16-20020a056402033000b005237b4b5082si5235631edw.81.2023.08.17.08.00.41; Thu, 17 Aug 2023 08:01:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=oyNmb5IZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243609AbjHPJwc (ORCPT + 99 others); Wed, 16 Aug 2023 05:52:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243694AbjHPJw0 (ORCPT ); Wed, 16 Aug 2023 05:52:26 -0400 Received: from pandora.armlinux.org.uk (unknown [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B994272C; Wed, 16 Aug 2023 02:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=vPIRm+r2j/XGNQXmGb4kJZdwIiaYA0yFVuKELbN9uLA=; b=oyNmb5IZWnRRDkvSc1JUzx4yvm LaVAUu4hmkg/TtletDcU/VC5E9VSgwp03B4OVBq03ZPk+9afMC+7tKkb6yg7DQ50tiV3Q32RBjlx5 jeR3Rw5K6R0mjxEfyNijqOP5XGAf0NzOVA/uKpayTE89oWcTHQmQO+sakz4KsUffXIhCWrm2wrtxb Gc394NOj28WCq8AAriIPnTOBwT+AEAl+rKWv36+WFggWjr+nYZzxORA7KY1u4gLIuMHaL5MOoJldG pcmp7BwXNppsxj4wmtWUxDCkyAGJSFerBpDBHF/62zdR/GD5nIfag2cQ2POAyh9nvwN541AJ6p8TW Ff48bYqQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:45260) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qWDBn-0002b3-2d; Wed, 16 Aug 2023 10:51:43 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qWDBl-0007ug-W6; Wed, 16 Aug 2023 10:51:42 +0100 Date: Wed, 16 Aug 2023 10:51:41 +0100 From: "Russell King (Oracle)" To: Andrew Lunn Cc: Justin Stitt , Iyappan Subramanian , Keyur Chudgar , Quan Nguyen , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nathan Chancellor , Nick Desaulniers , Tom Rix , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] net: mdio: fix -Wvoid-pointer-to-enum-cast warning Message-ID: References: <20230815-void-drivers-net-mdio-mdio-xgene-v1-1-5304342e0659@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,RDNS_NONE, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 15, 2023 at 10:41:39PM +0200, Andrew Lunn wrote: > On Tue, Aug 15, 2023 at 08:35:59PM +0000, Justin Stitt wrote: > > When building with clang 18 I see the following warning: > > | drivers/net/mdio/mdio-xgene.c:338:13: warning: cast to smaller integer > > | type 'enum xgene_mdio_id' from 'const void *' [-Wvoid-pointer-to-enum-cast] > > | 338 | mdio_id = (enum xgene_mdio_id)of_id->data; > > > > This is due to the fact that `of_id->data` is a void* while `enum > > xgene_mdio_id` 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 > > Reviewed-by: Andrew Lunn I wonder whether it would be better to use device_get_match_data() here? The whole of_match_device()...acpi_match_device() dance could become: + mdio_id = (uintptr_t)device_get_match_data(&pdev->dev); if (!mdio_id) return -ENODEV; It's probably something for a follow-up patch though. Reviewed-by: Russell King (Oracle) Thanks! -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!