summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorYoungjae Cho <y0.cho@samsung.com>2021-06-18 11:52:45 +0900
committerYoungjae Cho <y0.cho@samsung.com>2021-06-18 11:56:46 +0900
commite47362f0f83b6e0573ddb9e51f9f2b1eaf488b3e (patch)
treeb12bdd4e4fb63e94d2b72bbd7752bdb429a6c82a /hw
parent0e51c20c491e3be5148a5fb3a81fd9c0aa6b9226 (diff)
downloaddevice-rpi-e47362f0f83b6e0573ddb9e51f9f2b1eaf488b3e.tar.gz
device-rpi-e47362f0f83b6e0573ddb9e51f9f2b1eaf488b3e.tar.bz2
device-rpi-e47362f0f83b6e0573ddb9e51f9f2b1eaf488b3e.zip
board: fix parameter of get_device_serial_number()submit/tizen/20210618.075427accepted/tizen/unified/20210621.123310
Change-Id: I33b2e37cc1b7b48c6cac7145d87e3077d46e7009 Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/board/board.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/hw/board/board.c b/hw/board/board.c
index d22b204..225be19 100644
--- a/hw/board/board.c
+++ b/hw/board/board.c
@@ -28,24 +28,23 @@
#define SERIAL_FILE_PATH "/sys/firmware/devicetree/base/serial-number"
#define LINE_LEN 64
-static int get_device_serial_number(char **out)
+static int get_device_serial_number(char *buffer, int len)
{
FILE *fp;
- char *line, *p;
+ char *retval;
fp = fopen(SERIAL_FILE_PATH, "r");
if (!fp)
- return -1;
+ return -errno;
- line = malloc(LINE_LEN);
- p = fgets(line, LINE_LEN, fp);
- fclose(fp);
- if (p == NULL) {
- free(line);
- return -1;
+ retval = fgets(buffer, len, fp);
+ if (retval == NULL) {
+ fclose(fp);
+ return -errno;
}
- *out = p;
+ fclose(fp);
+
return 0;
}