bluetooth: Move the lower half null check to common place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
9103184722
commit
7df322c6be
@ -75,25 +75,17 @@
|
||||
|
||||
int hciuart_dev_initialize(void)
|
||||
{
|
||||
const struct btuart_lowerhalf_s *lower;
|
||||
int ret;
|
||||
|
||||
/* Perform one-time initialization */
|
||||
|
||||
hciuart_initialize();
|
||||
|
||||
/* Instantiate the HCI UART lower half interface */
|
||||
/* Instantiate the HCI UART lower half interface
|
||||
* Then initialize the HCI UART upper half driver with the bluetooth stack
|
||||
*/
|
||||
|
||||
lower = hciuart_instantiate(HCIUART_SERDEV);
|
||||
if (lower == NULL)
|
||||
{
|
||||
wlerr("ERROR: Failed to instantiate HCIUART%d\n", HCIUART_SERDEV + 1);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Then initialize the HCI UART upper half driver with the bluetooth stack */
|
||||
|
||||
ret = btuart_register(lower);
|
||||
ret = btuart_register(hciuart_instantiate(HCIUART_SERDEV));
|
||||
if (ret < 0)
|
||||
{
|
||||
wlerr("ERROR: btuart_register() failed: %d\n", ret);
|
||||
|
@ -75,25 +75,17 @@
|
||||
|
||||
int hciuart_dev_initialize(void)
|
||||
{
|
||||
const struct btuart_lowerhalf_s *lower;
|
||||
int ret;
|
||||
|
||||
/* Perform one-time initialization */
|
||||
|
||||
hciuart_initialize();
|
||||
|
||||
/* Instantiate the HCI UART lower half interface */
|
||||
/* Instantiate the HCI UART lower half interface
|
||||
* Then initialize the HCI UART upper half driver with the bluetooth stack
|
||||
*/
|
||||
|
||||
lower = hciuart_instantiate(HCIUART_SERDEV);
|
||||
if (lower == NULL)
|
||||
{
|
||||
wlerr("ERROR: Failed to instantiate HCIUART%d\n", HCIUART_SERDEV + 1);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Then initialize the HCI UART upper half driver with the bluetooth stack */
|
||||
|
||||
ret = btuart_register(lower);
|
||||
ret = btuart_register(hciuart_instantiate(HCIUART_SERDEV));
|
||||
if (ret < 0)
|
||||
{
|
||||
wlerr("ERROR: btuart_register() failed: %d\n", ret);
|
||||
|
@ -416,7 +416,11 @@ int btuart_register(FAR const struct btuart_lowerhalf_s *lower)
|
||||
|
||||
wlinfo("lower %p\n", lower);
|
||||
|
||||
DEBUGASSERT(lower != NULL);
|
||||
if (lower == NULL)
|
||||
{
|
||||
wlerr("ERROR: btuart lower half is NULL\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Allocate a new instance of the upper half driver state structure */
|
||||
|
||||
|
@ -181,7 +181,11 @@ int btuart_register(FAR const struct btuart_lowerhalf_s *lower)
|
||||
|
||||
wlinfo("lower %p\n", lower);
|
||||
|
||||
DEBUGASSERT(lower != NULL);
|
||||
if (lower == NULL)
|
||||
{
|
||||
wlerr("ERROR: btuart lower half is NULL\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Allocate a new instance of the upper half driver state structure */
|
||||
|
||||
|
@ -75,7 +75,11 @@ int btuart_register(FAR const struct btuart_lowerhalf_s *lower)
|
||||
|
||||
wlinfo("lower %p\n", lower);
|
||||
|
||||
DEBUGASSERT(lower != NULL);
|
||||
if (lower == NULL)
|
||||
{
|
||||
wlerr("ERROR: btuart lower half is NULL\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Allocate a new instance of the upper half driver state structure */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user