All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: u-boot@lists.denx.de, git@xilinx.com
Cc: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>,
	Michal Simek <monstr@monstr.eu>,
	T Karthik Reddy <t.karthik.reddy@xilinx.com>
Subject: [PATCH 01/10] xilinx: fru: Replace spaces with \0 in detected name
Date: Thu, 19 Aug 2021 13:19:40 +0200	[thread overview]
Message-ID: <6c4fac6edfc77f94f483d4697ed158437970fb63.1629371983.git.michal.simek@xilinx.com> (raw)
In-Reply-To: <cover.1629371983.git.michal.simek@xilinx.com>

FRU spec expected \0 for unused symbols but unfortunately a lot of boards
are using spaces instead of \0. That's why after saving it to desc->name
name is checked again and all spaces are converted to \0. This will ensure
that names can be used for string manipulations like concatenation.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 board/xilinx/common/board.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 90c87bab5cff..1458b31c21a9 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -168,7 +168,7 @@ static bool xilinx_detect_legacy(u8 *buffer)
 static int xilinx_read_eeprom_fru(struct udevice *dev, char *name,
 				  struct xilinx_board_description *desc)
 {
-	int ret, eeprom_size;
+	int i, ret, eeprom_size;
 	u8 *fru_content;
 
 	/* FIXME this is shortcut - if eeprom type is wrong it will fail */
@@ -207,6 +207,10 @@ static int xilinx_read_eeprom_fru(struct udevice *dev, char *name,
 		sizeof(desc->manufacturer));
 	strncpy(desc->name, (char *)fru_data.brd.product_name,
 		sizeof(desc->name));
+	for (i = 0; i < sizeof(desc->name); i++) {
+		if (desc->name[i] == ' ')
+			desc->name[i] = '\0';
+	}
 	strncpy(desc->revision, (char *)fru_data.brd.rev,
 		sizeof(desc->revision));
 	strncpy(desc->serial, (char *)fru_data.brd.serial_number,
-- 
2.32.0


  reply	other threads:[~2021-08-19 11:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 11:19 [PATCH 00/10] xilinx: Add support for DTB reselection Michal Simek
2021-08-19 11:19 ` Michal Simek [this message]
2021-08-19 11:19 ` [PATCH 02/10] xilinx: Use variable for passing board_name Michal Simek
2021-08-19 11:19 ` [PATCH 03/10] xilinx: common: Change board_info[] handling Michal Simek
2021-08-19 11:19 ` [PATCH 04/10] xilinx: common: Free allocated structure Michal Simek
2021-08-19 11:19 ` [PATCH 05/10] xilinx: Add support for generic board detection Michal Simek
2021-08-19 11:19 ` [PATCH 06/10] xilinx: zynqmp: Check that DT is 64bit aligned Michal Simek
2021-08-19 11:19 ` [PATCH 07/10] Makefile: Align fit-dtb.blob and u-boot.itb by 64bits for 64bit systems Michal Simek
2021-08-19 15:56   ` Andre Przywara
2021-08-19 16:01     ` Michal Simek
2021-08-19 16:18       ` Tom Rini
2021-08-19 16:31         ` Michal Simek
2021-08-19 16:44           ` Tom Rini
2021-08-19 11:19 ` [PATCH 08/10] arm64: dts: Make sure that all DTBs are 64bit aligned " Michal Simek
2021-08-19 16:10   ` Andre Przywara
2021-08-19 16:34     ` Michal Simek
2021-08-19 11:19 ` [PATCH 09/10] xilinx: zynqmp: Generate different u-boot.itb for MULTI_DTB_FIT Michal Simek
2021-08-19 11:19 ` [PATCH 10/10] xilinx: common: Enabling generic function for DT reselection Michal Simek
2021-08-23  7:37 [PATCH 00/10] xilinx: Add support for DTB reselection Michal Simek
2021-08-23  7:37 ` [PATCH 01/10] xilinx: fru: Replace spaces with \0 in detected name Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6c4fac6edfc77f94f483d4697ed158437970fb63.1629371983.git.michal.simek@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=ashok.reddy.soma@xilinx.com \
    --cc=git@xilinx.com \
    --cc=monstr@monstr.eu \
    --cc=t.karthik.reddy@xilinx.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.