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 74526C433FE for ; Wed, 6 Oct 2021 21:45:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55594611CC for ; Wed, 6 Oct 2021 21:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239606AbhJFVrt (ORCPT ); Wed, 6 Oct 2021 17:47:49 -0400 Received: from gate.crashing.org ([63.228.1.57]:45236 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbhJFVrs (ORCPT ); Wed, 6 Oct 2021 17:47:48 -0400 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 Cc: Rob Herring , Rich Felker , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Guo Ren , "H. Peter Anvin" , linux-riscv@lists.infradead.org, Will Deacon , Jonas Bonn , Florian Fainelli , Yoshinori Sato , linux-sh@vger.kernel.org, x86@kernel.org, Russell King , linux-csky@vger.kernel.org, Ingo Molnar , bcm-kernel-feedback-list@broadcom.com, Catalin Marinas , Palmer Dabbelt , 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 , Greg Kroah-Hartman , Frank Rowand , James Morse , Paul Mackerras , linuxppc-dev@lists.ozlabs.org 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 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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