diff options
author | Youngjae Cho <y0.cho@samsung.com> | 2021-06-18 12:09:07 +0900 |
---|---|---|
committer | Youngjae Cho <y0.cho@samsung.com> | 2021-06-18 12:09:07 +0900 |
commit | 303faba4f6a917ef5bc9624045692c1e6f5d459c (patch) | |
tree | aadea4a6b20ff458be7b52ac1623aa00a74b1be5 | |
parent | 47db627a9c02d33b15fbb74be29c487520ab4299 (diff) | |
download | device-tm1-303faba4f6a917ef5bc9624045692c1e6f5d459c.tar.gz device-tm1-303faba4f6a917ef5bc9624045692c1e6f5d459c.tar.bz2 device-tm1-303faba4f6a917ef5bc9624045692c1e6f5d459c.zip |
board: fix parameter of get_device_serial_number()submit/tizen/20210618.075427accepted/tizen/unified/20210621.123303
Change-Id: Ifd9ab60a29485d39e96b8e1d2a8b1ab149133e84
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
-rw-r--r-- | hw/board/board.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/hw/board/board.c b/hw/board/board.c index e9d11fc..7431654 100644 --- a/hw/board/board.c +++ b/hw/board/board.c @@ -115,32 +115,24 @@ static int get_serialno_from_cpuinfo(void) return -EIO; } -static int get_device_serial_number(char **out) +static int get_device_serial_number(char *buffer, int len) { int ret; - if (info.serial_len > 0 && strlen(info.serial) == info.serial_len) { - *out = strdup(info.serial); - if (!out) { - _E("Out of memory, strdup failed."); - return -ENOMEM; - } - return 0; - } - ret = get_serialno_from_dat(); - if (ret < 0) { - ret = get_serialno_from_cpuinfo(); + if (info.serial_len == 0) { + ret = get_serialno_from_dat(); if (ret < 0) { - _E("Failed to find serial number."); - return ret; + ret = get_serialno_from_cpuinfo(); + if (ret < 0) { + _E("Failed to find serial number."); + return ret; + } } } - *out = strdup(info.serial); - if (!out) - _E("Out of memory, strdup failed."); + strncpy(buffer, info.serial, len); - return ret; + return 0; } static int get_device_revision(int *out) |