From 7ed504095c8cc0a0843bf97b40c915cd13cffb27 Mon Sep 17 00:00:00 2001 From: libo Date: Wed, 4 Apr 2018 15:35:13 +0800 Subject: [PATCH] bluetooth: fix some coverity error PD#163690: driver defects cleanup #254 #361 Change-Id: I6ba110926488bc598c37b462edbb3a1dee56a2dd Signed-off-by: libo --- drivers/amlogic/bluetooth/bluesleep.c | 2 +- drivers/amlogic/bluetooth/bt_device.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/amlogic/bluetooth/bluesleep.c b/drivers/amlogic/bluetooth/bluesleep.c index 9631491..ab2e4a7 100644 --- a/drivers/amlogic/bluetooth/bluesleep.c +++ b/drivers/amlogic/bluetooth/bluesleep.c @@ -594,7 +594,7 @@ static int bluesleep_probe(struct platform_device *pdev) bsi->host_wake_irq = irq_of_parse_and_map(pdev->dev.of_node, 0); - if (bsi->host_wake_irq < 0) { + if (bsi->host_wake_irq == 0) { BT_ERR("couldn't find host_wake irq"); ret = -ENODEV; goto free_bt_ext_wake; diff --git a/drivers/amlogic/bluetooth/bt_device.c b/drivers/amlogic/bluetooth/bt_device.c index af0ea21..f9edbf5 100644 --- a/drivers/amlogic/bluetooth/bt_device.c +++ b/drivers/amlogic/bluetooth/bt_device.c @@ -203,7 +203,7 @@ static int bt_probe(struct platform_device *pdev) struct bt_dev_runtime_data *prdata; #ifdef CONFIG_OF - if (pdev->dev.of_node) { + if (pdev && pdev->dev.of_node) { const char *str; struct gpio_desc *desc; @@ -256,6 +256,8 @@ static int bt_probe(struct platform_device *pdev) if (ret) pdata->power_on_pin_OD = 0; pr_info("bt: power_on_pin_OD = %d;\n", pdata->power_on_pin_OD); + } else { + pdata = (struct bt_dev_data *)(pdev->dev.platform_data); } #else pdata = (struct bt_dev_data *)(pdev->dev.platform_data); -- 2.7.4