From patchwork Wed Mar 18 16:22:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1257639 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48jFhH5vjdz9sPF for ; Thu, 19 Mar 2020 03:23:11 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4777B80721; Wed, 18 Mar 2020 17:23:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 612EF80E7C; Wed, 18 Mar 2020 17:23:02 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 16FF980390 for ; Wed, 18 Mar 2020 17:22:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=miquel.raynal@bootlin.com X-Originating-IP: 91.224.148.103 Received: from localhost.localdomain (unknown [91.224.148.103]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 040FE2000A; Wed, 18 Mar 2020 16:22:56 +0000 (UTC) From: Miquel Raynal To: Simon Glass Cc: Philipp Tomsich , Kever Yang , , Miquel Raynal Subject: [PATCH] rockchip: mkimage: Use an existing macro instead of a decimal value Date: Wed, 18 Mar 2020 17:22:55 +0100 Message-Id: <20200318162255.26796-1-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Depending on the SoC, a header of four characters is prepended to the image. There is already a macro defining the number of characters: RK_SPL_HDR_SIZE, so use it instead of hardcoding "4". Signed-off-by: Miquel Raynal Reviewed-by: Kever Yang --- tools/rkcommon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/rkcommon.c b/tools/rkcommon.c index 0d908daee80..a80899e2806 100644 --- a/tools/rkcommon.c +++ b/tools/rkcommon.c @@ -246,11 +246,13 @@ static int rkcommon_parse_header(const void *buf, struct header0_info *header0, rkcommon_offset_to_spi(hdr1_offset)); for (i = 0; i < ARRAY_SIZE(spl_infos); i++) { - if (!memcmp(&hdr1_sdmmc->magic, spl_infos[i].spl_hdr, 4)) { + if (!memcmp(&hdr1_sdmmc->magic, spl_infos[i].spl_hdr, + RK_SPL_HDR_SIZE)) { if (spl_info) *spl_info = &spl_infos[i]; return IH_TYPE_RKSD; - } else if (!memcmp(&hdr1_spi->magic, spl_infos[i].spl_hdr, 4)) { + } else if (!memcmp(&hdr1_spi->magic, spl_infos[i].spl_hdr, + RK_SPL_HDR_SIZE)) { if (spl_info) *spl_info = &spl_infos[i]; return IH_TYPE_RKSPI;