From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08CE2C433EF for ; Wed, 6 Oct 2021 21:40:49 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A30D611C6 for ; Wed, 6 Oct 2021 21:40:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5A30D611C6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HPnv26nkpz3blb for ; Thu, 7 Oct 2021 08:40:46 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.crashing.org (client-ip=63.228.1.57; helo=gate.crashing.org; envelope-from=segher@kernel.crashing.org; receiver=) Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lists.ozlabs.org (Postfix) with ESMTP id 4HPntY25Z2z2yJM for ; Thu, 7 Oct 2021 08:40:20 +1100 (AEDT) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 196LRU0O007032; Wed, 6 Oct 2021 16:27:30 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 196LRS4V007029; Wed, 6 Oct 2021 16:27:28 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 6 Oct 2021 16:27:28 -0500 From: Segher Boessenkool To: Stafford Horne Subject: Re: [PATCH 06/12] openrisc: Use of_get_cpu_hwid() Message-ID: <20211006212728.GM10333@gate.crashing.org> References: <20211006164332.1981454-1-robh@kernel.org> <20211006164332.1981454-7-robh@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , "Rafael J. Wysocki" , Catalin Marinas , x86@kernel.org, Guo Ren , "H. Peter Anvin" , linux-riscv@lists.infradead.org, Will Deacon , Jonas Bonn , Rob Herring , Florian Fainelli , Frank Rowand , linux-sh@vger.kernel.org, Russell King , linux-csky@vger.kernel.org, Ingo Molnar , bcm-kernel-feedback-list@broadcom.com, James Morse , devicetree@vger.kernel.org, Albert Ou , Ray Jui , Stefan Kristiansson , openrisc@lists.librecores.org, Borislav Petkov , Paul Walmsley , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Scott Branden , Yoshinori Sato , linux-kernel@vger.kernel.org, Palmer Dabbelt , Greg Kroah-Hartman , Paul Mackerras , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, Oct 07, 2021 at 05:44:00AM +0900, Stafford Horne wrote: > You have defined of_get_cpu_hwid to return u64, will this create compiler > warnings when since we are storing a u64 into a u32? > > It seems only if we make with W=3. Yes. This is done by -Wconversion, "Warn for implicit conversions that may alter a value." > I thought we usually warned on this. This warning is not in -Wall or -Wextra either, it suffers too much from false positives. It is very natural to just ignore the high bits of modulo types (which is what "unsigned" types *are*). Or the bits that "fall off" on a conversion. The C standard makes this required behaviour, it is useful, and it is the only convenient way of getting this! Segher