Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5125676yba; Tue, 30 Apr 2019 09:31:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqx5lj9jtaOGgI6ueoBeJ81sXp3kP/G8L7gukPWJK1ZUhIGWs2Qk9z8LuJndOPDJ5KqS1tqy X-Received: by 2002:a65:62cc:: with SMTP id m12mr67978459pgv.118.1556641888272; Tue, 30 Apr 2019 09:31:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556641888; cv=none; d=google.com; s=arc-20160816; b=inOPpUV3pE/upjd5XWKaDadT+fPIGzD8eViv/PTKV/gjMYiEGvLW61YhOzCpKN3qW2 K79AJtfzPzwXGIGbdyhuMYSxlEP06tvAnJHpJz43tkBH5+n81Y0AD/RWIRcgkXBPgi6W KHIUx3Ul9C7rsZMDw4pPjDlEilNTgnR/66/fVMI6H5tY538Yv4h+HiJIgjaa6mpzjMkg ZppbMyLdtpuDzAxUhlBrwma6kSrur452q0abbTLNGsrazoA1xYoKKsk/RpiCkz1OfpRB +M6eiJyVv6MJT7HImfAsyk+Lj8cphB7fSxvGbD72pLgRqs7kElsYLBGnFSSIb5xv5lNI /qMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=1jOWjc9sv7NsGDbJtvu/TnPU13dJOvBN74NeQMobQak=; b=sUyx/+Pd9t2dS4yZCjYdE5dHX4FhwOz7kbvLA1f2VXDWDki8qU+9RIpUrHUVYtw0dr dRVn9rGvJ06odp53WhQBq0o1FRKKcWT6RIDo6GbjKg9D4cf/Lbe7lhmEorXDX2wuFVjl d/aIyFkQL0SEIT1BdEp74RD8VBw1ZCspS7TylV5gs45I3lopaT+B1D8rO+5PlC7FE20R G3g2/8Hun1SeeRXkiAL62lGxTPPdOc6ThFcgIv7wYjZvPz13c1wtQWXM43dxpLAI/t34 9WTqr3DiTHvn4J12IX9ojLsZx32aCgb2vefDSEYa+tD+7CyO3mZC7xOjaHDHuir1IyMQ ZSPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aUcKqWfe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y38si17961235pgk.95.2019.04.30.09.31.12; Tue, 30 Apr 2019 09:31:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aUcKqWfe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726155AbfD3Q2s (ORCPT + 99 others); Tue, 30 Apr 2019 12:28:48 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39040 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726006AbfD3Q2r (ORCPT ); Tue, 30 Apr 2019 12:28:47 -0400 Received: by mail-pg1-f195.google.com with SMTP id l18so7076991pgj.6 for ; Tue, 30 Apr 2019 09:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1jOWjc9sv7NsGDbJtvu/TnPU13dJOvBN74NeQMobQak=; b=aUcKqWfe1AePUG3HV2kyOdwdr0VGaKqoEbIYWixjNLaiL8G5+KRY6tkNyDCWS60iH3 HbylEF0Ymk5FdzhveDSHC5wR1sC6y2hQcgZE3xia98Mu7/EUSt48g0HkGJGpMYBGjKt6 Wti509HNf2nx84Sbh0WRbDRiXk0xZ+ajevdIMK2LUXfZj0kdEPONrSuC7+TCY8eam8sd KDyVXFVzJ1epQxuK8H9pUutHdRw8KmEAiGyQXUGEBzN/SJKzf3MHa383CWMaY9+Btc8v tWjCvkbo8CC9UtlnZpb3Z77HV+20mDRfzVlQeN7XM1d09TajBMW/3iqZwSYGm/ChTMXX oLZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1jOWjc9sv7NsGDbJtvu/TnPU13dJOvBN74NeQMobQak=; b=Hio/F67bP9uHsFKPWQSwW42oZTvmf4wD8YmXCW186jjLJdv1TeJ99L+DB+D6be9wXN 2UlYuWgz4HZQ3iKUmZzoPaXFQh7OTURRdak19H8ApgI4hcdcfkyB/S1zcXbPMr4ARpJt zX0DUo4pFXUWBd5ygIikyOCl2bH9ky/OJux1EIgaoxdRLQdhSvM2mqhbCMCat7j9NSr4 MeFPGxeC/M0iEbAnZJ1RuKApTpg/+qlokr/WMjT5YSfJJR8Dfv9KhCHzPaeWsxn3MmlK Ipb+qoQ69P9gedHfcUrJOVKAAHcP/E5Sqtq/6qlcYaewmrb6b3kZOaS3i1e7oDYckhAs hvYQ== X-Gm-Message-State: APjAAAW9vQn2yGsDifBTqctwrrpRJa3wDByUIh9hro1kf1TOru20E3PS nUx0ruT9edJJZUzHIbD1JKmNd0NLeYrVrz9pIiwxpg== X-Received: by 2002:a63:f817:: with SMTP id n23mr25948490pgh.302.1556641726271; Tue, 30 Apr 2019 09:28:46 -0700 (PDT) MIME-Version: 1.0 References: <46b3e8edf27e4c8f98697f9e7f2117d6@AcuMS.aculab.com> <20190430145624.30470-1-tranmanphong@gmail.com> In-Reply-To: <20190430145624.30470-1-tranmanphong@gmail.com> From: Nick Desaulniers Date: Tue, 30 Apr 2019 09:28:35 -0700 Message-ID: Subject: Re: [PATCH V2] of: fix clang -Wunsequenced for be32_to_cpu() To: Phong Tran Cc: robh+dt@kernel.org, Frank Rowand , pantelis.antoniou@konsulko.com, David.Laight@aculab.com, hch@infradead.org, Nathan Chancellor , devicetree@vger.kernel.org, LKML , clang-built-linux Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 30, 2019 at 7:58 AM Phong Tran wrote: > > Now, make the loop explicit to avoid clang warning. > > ./include/linux/of.h:238:37: warning: multiple unsequenced modifications > to 'cell' [-Wunsequenced] > r = (r << 32) | be32_to_cpu(*(cell++)); > ^~ > ./include/linux/byteorder/generic.h:95:21: note: expanded from macro > 'be32_to_cpu' > ^ > ./include/uapi/linux/byteorder/little_endian.h:40:59: note: expanded > from macro '__be32_to_cpu' > ^ > ./include/uapi/linux/swab.h:118:21: note: expanded from macro '__swab32' > ___constant_swab32(x) : \ > ^ > ./include/uapi/linux/swab.h:18:12: note: expanded from macro > '___constant_swab32' > (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ > ^ > > Signed-off-by: Phong Tran Thanks for the patch. Reported-by: Nick Desaulniers Link: https://github.com/ClangBuiltLinux/linux/issues/460 Suggested-by: David Laight > --- > include/linux/of.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/linux/of.h b/include/linux/of.h > index e240992e5cb6..71ca25ac01f6 100644 > --- a/include/linux/of.h > +++ b/include/linux/of.h > @@ -234,8 +234,8 @@ extern struct device_node *of_find_all_nodes(struct device_node *prev); > static inline u64 of_read_number(const __be32 *cell, int size) > { > u64 r = 0; > - while (size--) > - r = (r << 32) | be32_to_cpu(*(cell++)); > + for(; size--; cell++) > + r = (r << 32) | be32_to_cpu(*cell); > return r; > } > > -- > 2.21.0 > -- Thanks, ~Nick Desaulniers