From patchwork Wed Jan 15 05:57:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Bansal X-Patchwork-Id: 1223188 X-Patchwork-Delegate: priyanka.jain@nxp.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=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=ctPwiiMs; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47yGnD6zFGz9sR0 for ; Wed, 15 Jan 2020 16:57:17 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CCAE48178F; Wed, 15 Jan 2020 06:57:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="ctPwiiMs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E213C8178B; Wed, 15 Jan 2020 06:57:06 +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=0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FORGED_SPF_HELO, SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on0616.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0c::616]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A4EF18178B for ; Wed, 15 Jan 2020 06:57:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pankaj.bansal@nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vx0qA7eO39G85+bEUIta85kFDC3Lrw1BKVG05PvQwNmhsVa2laR0kvOnGWlT+xDh7zDb4bxnvtLXRkkxkVGwjeRMaUnzZQASnp76fhnauVXSjBGQv0YKwJKdzOqudnduUSrkNDxgB1dMknr0ufsH3s5CrPg7B3XaSobBnBtzO+jLmIVFvkqID0SKddpmKyVMJxghwQGqRNu4g/QydF0fx2439LJrT8kgGB/IDkdi7DcP5yXezS1pl69eZyqdj4rdAI+H4MRmumuWGewYSZRTbXGEhAtm/YVdM1pkjYJtF2ekaNh0AX3xj8tuZVamwZMCD3q3HBJc3hqzejfQlJPOkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Sxl6jLNDwmsIn/JUrJQXIpZl727ebnRmpeYMzJzli1o=; b=TrnAN3tbvV72/rN4Tb5u7te7xjoXNS6oav42oAeUOX3MFUb0y9Fdg2U7XYxITVYSy7KSehXAgHxzds9UPlrRJnHPVWMtln4Np7Kz16PSz9eV5ow9xam2IIayDBPlbf2FPqDAOa25a/eoAtHX+m1oTPmPr9kNMcJE+g17i94fJDROx6V1SbrjJsaWDCle7vlb40ls9xGsZmpugbXMcm3o5Ly+sS732YyCbht4sJyaTwwopYaibq+g1UQUztDP0VGo18zHAfze1VW6JFSLFYMavkbqxj/i5RLBd/4EfeXJU0WVrDdXfJPDt0/44t2QLzdiRvIccYqrdJ5qBWBYkEGdFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Sxl6jLNDwmsIn/JUrJQXIpZl727ebnRmpeYMzJzli1o=; b=ctPwiiMsXZDzYL9B/o35M6ZyPNoWClJ/OcgDMKyIWdQuScxLxhv9U1f7JAmBAiAxX9GnFlabt5bAGZbhqLMF6xsba37hrBoAGl4Rd39odlfUMssandnX6CIxgvdFwjVTrNH7OBp9rFnNhy7bWac+i4BrnvfsUmhlsbeVGINq73g= Received: from VI1PR0401MB2496.eurprd04.prod.outlook.com (10.168.65.10) by VI1SPR00MB2490.eurprd04.prod.outlook.com (10.175.186.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.13; Wed, 15 Jan 2020 05:57:01 +0000 Received: from VI1PR0401MB2496.eurprd04.prod.outlook.com ([fe80::8823:663d:c6ed:cbd6]) by VI1PR0401MB2496.eurprd04.prod.outlook.com ([fe80::8823:663d:c6ed:cbd6%12]) with mapi id 15.20.2623.017; Wed, 15 Jan 2020 05:57:01 +0000 Received: from uefi-workstation.ap.freescale.net (92.120.1.69) by BM1PR0101CA0017.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.19 via Frontend Transport; Wed, 15 Jan 2020 05:56:59 +0000 From: Pankaj Bansal To: Priyanka Jain , Meenakshi Aggarwal Subject: [PATCH v2] board: fsl: lx2160a: Fix the loop in board_fix_fdt function Thread-Topic: [PATCH v2] board: fsl: lx2160a: Fix the loop in board_fix_fdt function Thread-Index: AQHVy2iato1TEDqAZ0OBCoFW8dkz/w== Date: Wed, 15 Jan 2020 05:57:00 +0000 Message-ID: <20200115111706.4762-1-pankaj.bansal@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0017.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::27) To VI1PR0401MB2496.eurprd04.prod.outlook.com (2603:10a6:800:56::10) x-mailer: git-send-email 2.17.1 authentication-results: spf=none (sender IP is ) smtp.mailfrom=pankaj.bansal@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [92.120.1.69] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 8eb719ef-8b7e-49d7-5fbd-08d7997fbd05 x-ms-traffictypediagnostic: VI1SPR00MB2490:|VI1SPR00MB2490: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:404; x-forefront-prvs: 02830F0362 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(366004)(136003)(376002)(39860400002)(396003)(199004)(189003)(64756008)(2906002)(8936002)(1076003)(54906003)(86362001)(4326008)(81166006)(81156014)(110136005)(6512007)(478600001)(316002)(66446008)(6486002)(6636002)(5660300002)(52116002)(186003)(6666004)(36756003)(66476007)(71200400001)(66556008)(8676002)(66946007)(956004)(26005)(44832011)(16526019)(6506007)(2616005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1SPR00MB2490; H:VI1PR0401MB2496.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: o4yPcp3b7r84Lot/svoksq4+dCbZ7HACD12hyWDExmOCVfwnAkeA/mJXPfLCDtWePIm1xnymRZRlGp18F0lm9dFbjq0ziO0SHjn85/7J59MMURj8/fL6BUCCANq7hkPSPU78Up47vmdmUUC2FTYiiRPXvK8f5m6XMRmhjdTSt2GqFiamzdl1iE/2Oxej+c1G2gT/Piz4KDulqW65h8mWltQEYHAluQMPbTHH0d74kz06feN9k4dYnnubYfss7yJmTvR3RCEDvYEFM/sUWLJ/1rVyhpm6aEO5UnNRF3wydkySoBwKoKFYLFRTmcEbmdsCHZ9JIbreS6y8VBkNIkGm9thRSpTgMz/cwGLX7Gmj++f7AGupQkdFu+j1wtn2wECwm2p3FjXEj0TetwD8wIahCPUFf5Zxnj5N8P+RKFUCeyDzPP1VF8d5K4lfjqtUtpXF MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8eb719ef-8b7e-49d7-5fbd-08d7997fbd05 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 05:57:00.9695 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: eBmqgc2rmGA74LtR5JnOMZI4VzNO1YgaluDgvbAJmxnWOZGp99R1E3s20xJvrrCa2DzaFlkvUQmKPm91tPuIfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1SPR00MB2490 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "u-boot@lists.denx.de" Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean Fix loop in board_fix_fdt that erroneously increments the counter in all cases. the counter should be incremented only if a matching string has been found. Fixes: 5d535aa40b ("board: fsl: lx2160a: implement board_fix_fdt") Signed-off-by: Pankaj Bansal --- Notes: V2: - assigned value to i when declared : suggested by Jagdish - removed mention of "for loop" from commit header and description becuase we have replaced for loop with while loop : suggested by Jagdish board/freescale/lx2160a/lx2160a.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c index e5b7fec9a4..e1edd9225c 100644 --- a/board/freescale/lx2160a/lx2160a.c +++ b/board/freescale/lx2160a/lx2160a.c @@ -131,7 +131,7 @@ int board_fix_fdt(void *fdt) { "ccsr", "dbi" }, { "pf_ctrl", "ctrl" } }; - int off = -1, i; + int off = -1, i = 0; if (IS_SVR_REV(get_svr(), 1, 0)) return 0; @@ -148,7 +148,7 @@ int board_fix_fdt(void *fdt) reg_name = reg_names; remaining_names_len = names_len - (reg_name - reg_names); - for (i = 0; (i < ARRAY_SIZE(reg_names_map)) && names_len; i++) { + while ((i < ARRAY_SIZE(reg_names_map)) && remaining_names_len) { old_name_len = strlen(reg_names_map[i].old_str); new_name_len = strlen(reg_names_map[i].new_str); if (memcmp(reg_name, reg_names_map[i].old_str, @@ -164,6 +164,7 @@ int board_fix_fdt(void *fdt) new_name_len); names_len -= old_name_len; names_len += new_name_len; + i++; } reg_name = memchr(reg_name, '\0', remaining_names_len);