From eacca2b7a2e8e4163be5a7497ee26cfa89db1d96 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 21 Sep 2020 15:02:23 +0800 Subject: [PATCH] wireless/bluetooth: replace open with file_open in uart shim drivers it is simpler than open and then file_detach Signed-off-by: Xiang Xiao Change-Id: I22585b7450804c6c012fecf369a8d7e25970c192 --- drivers/wireless/bluetooth/bt_uart_shim.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/wireless/bluetooth/bt_uart_shim.c b/drivers/wireless/bluetooth/bt_uart_shim.c index 062b83ea91..8d9ac8fef9 100644 --- a/drivers/wireless/bluetooth/bt_uart_shim.c +++ b/drivers/wireless/bluetooth/bt_uart_shim.c @@ -434,7 +434,7 @@ static int hcicollecttask(int argc, FAR char **argv) FAR void *bt_uart_shim_getdevice(FAR char *path) { FAR struct hciuart_state_s *s; - int f2; + int ret; /* Get the memory for this shim instance */ @@ -448,19 +448,14 @@ FAR void *bt_uart_shim_getdevice(FAR char *path) s = &g_n->state; - f2 = open(path, O_RDWR | O_BINARY); - - if (f2 < 0) + ret = file_open(&s->f, path, O_RDWR | O_BINARY); + if (ret < 0) { kmm_free(g_n); g_n = 0; return 0; } - /* Detach the file and give it somewhere to be kept */ - - s->h = file_detach(f2, &s->f); - /* Hook the routines in */ memcpy(&g_n->lower, &g_lowerstatic, sizeof(struct btuart_lowerhalf_s));