From patchwork Thu Jun 22 08:57:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 106192 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp17364obh; Thu, 22 Jun 2017 01:58:22 -0700 (PDT) X-Received: by 10.80.215.94 with SMTP id i30mr1765718edj.135.1498121902781; Thu, 22 Jun 2017 01:58:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498121902; cv=none; d=google.com; s=arc-20160816; b=y60V6bnG0UVvOuaLOZH8mgLD5z3lsedveMWyGrsnIUDJWAh8VOikN4a0YiS2TK9hg7 D0x+kmFOHMqkiJIMxUGsrwaSMzVl6k+2DC0WYinLzL+YI4HUwZCSuGH8zIr9hTqpa7bR sszamna/0ilvC0F1KhmqHK5Em+irhUVntaSe+d/lqR4MrlMIDfrMuFDY+8FZ+Hi4rckm 6toYSxrxR/Z3bl1iwwvGPiCT0YV5liLZavtTlcluKLDLNd/1U978gequ6m2sx8l4oeyB HHOaAPme4eCje7BcMa63/cXAL8a+O06dcdzb4nxavRZSS3tzQWtjJlQRT+l6IqBOx30P S8GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :dkim-filter:arc-authentication-results; bh=X/Bv5u4E4BBcR+ktbhK9mYfu+sotYTe1WXHxudgfBv8=; b=T0EtkL4BXOUCwGxXLlz3uIKh3gX7FH5IdmSVndZNLAZikd7eAwk5N9Jv2KVIxPR7nL F2ZYZe4PV7K1kuvDetvxGbRF+XoZHFEnL0bDUlXcWBL/K2Pf7HL59ww/VlZrwHnXCHuX 8NGT0JiKuSPI8MQATIcs6A1myHUFdajtVtiYm6bQIA/iuVmkgrzY7G4M4tSjDKL2ysof wxxnCcpqd5shAIdObAqtvGEwj5ikrM1qyvZYpAc1kpDuFWPGJING0tVnsxz2ioRCY7tT ftvGmRbdwD1Prt+GxOJ3AH7pDrA84CEuSO6qgXt3eEJTgjPbCt+3OFDdyROBBSRDNV/f ZVsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.b=exImz2G8; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id k32si44462edd.139.2017.06.22.01.58.22; Thu, 22 Jun 2017 01:58:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.b=exImz2G8; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 4C9CCC21C82; Thu, 22 Jun 2017 08:58:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id CFD86C21C4E; Thu, 22 Jun 2017 08:58:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D6BA3C21C4E; Thu, 22 Jun 2017 08:58:16 +0000 (UTC) Received: from conuserg-09.nifty.com (conuserg-09.nifty.com [210.131.2.76]) by lists.denx.de (Postfix) with ESMTPS id CB494C21C49 for ; Thu, 22 Jun 2017 08:58:15 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id v5M8vrYW003110; Thu, 22 Jun 2017 17:57:53 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v5M8vrYW003110 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1498121874; bh=5/CftP4YNHd7ND0kuLm81DV1+QuZJBEIqqPn5O0nkqY=; h=From:To:Cc:Subject:Date:From; b=exImz2G8IHGfsCNbPjX2T0WpgAu72EivrvT2o8uW1Qv4DRtLsUh0BesmhtUFi+fRb O/t5OQRA5djYK5BxBM8P/F30U0Jsey0pwUQ9GZsmY9dgR7Q7cZdpvL/lQS9HLh1387 OSme3dD6N31JrOKv59YMOciivl4M9fYM2pOWOU93S0fuIm1DcUTnfSVUWkVDvZ+sFk VOQ5clMcf98qOpajqwPNCA/pASz8ouk8GcOQt87I4+69CCNC7W4s5vmhNZeVrLRLPA EQ8UPttLcrKIk38Hkjcgg+hqC/t9gU1Ik/wpq4E01xVSxRlBruBerxCQaX3gTZiT0I 5P7Bfnw2kTIiQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Thu, 22 Jun 2017 17:57:50 +0900 Message-Id: <1498121870-22893-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Subject: [U-Boot] [PATCH] dm: ofnode: use fdt32_t for DT property value to fix sparse warning X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" DTB is encoded in big endian. When we retrieve property values, we need to use fdt32_to_cpu (aka be32_to_cpu) for endian conversion. This is a bit error-prone, but sparse is useful to detect endian mismatch. We need to use (fdt32_t *) instead of (u32 *) for a pointer of a property value. Otherwise sparse warns "cast to restricted __be32". Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass Reviewed-by: Simon Glass --- drivers/core/ofnode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 5a3e1d452fbb..0ad0add7cb18 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -23,7 +23,7 @@ int ofnode_read_u32(ofnode node, const char *propname, u32 *outp) if (ofnode_is_np(node)) { return of_read_u32(ofnode_to_np(node), propname, outp); } else { - const int *cell; + const fdt32_t *cell; int len; cell = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), @@ -477,7 +477,7 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname, int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type, const char *propname, struct fdt_pci_addr *addr) { - const u32 *cell; + const fdt32_t *cell; int len; int ret = -ENOENT;