2015-11-16 13:12:40

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH] emulator/hciemu: Fix return value

make throws out the following errors.

emulator/hciemu.c: In function ‘hciemu_get_master_scan_enable’:
emulator/hciemu.c:433:3: error: return makes integer from pointer without a cast [-Werror]
return NULL;
^
emulator/hciemu.c: In function ‘hciemu_get_master_le_scan_enable’:
emulator/hciemu.c:441:3: error: return makes integer from pointer without a cast [-Werror]
return NULL;
^
cc1: all warnings being treated as errors

Fixed by returning zero.
---
emulator/hciemu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/emulator/hciemu.c b/emulator/hciemu.c
index c8d9db5..6a53499 100644
--- a/emulator/hciemu.c
+++ b/emulator/hciemu.c
@@ -430,7 +430,7 @@ const uint8_t *hciemu_get_client_bdaddr(struct hciemu *hciemu)
uint8_t hciemu_get_master_scan_enable(struct hciemu *hciemu)
{
if (!hciemu || !hciemu->master_dev)
- return NULL;
+ return 0;

return btdev_get_scan_enable(hciemu->master_dev);
}
@@ -438,7 +438,7 @@ uint8_t hciemu_get_master_scan_enable(struct hciemu *hciemu)
uint8_t hciemu_get_master_le_scan_enable(struct hciemu *hciemu)
{
if (!hciemu || !hciemu->master_dev)
- return NULL;
+ return 0;

return btdev_get_le_scan_enable(hciemu->master_dev);
}
--
1.9.1



2015-11-16 13:51:40

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH] emulator/hciemu: Fix return value

Hi Gowtham,

On Mon, Nov 16, 2015, Gowtham Anandha Babu wrote:
> make throws out the following errors.
>
> emulator/hciemu.c: In function ‘hciemu_get_master_scan_enable’:
> emulator/hciemu.c:433:3: error: return makes integer from pointer without a cast [-Werror]
> return NULL;
> ^
> emulator/hciemu.c: In function ‘hciemu_get_master_le_scan_enable’:
> emulator/hciemu.c:441:3: error: return makes integer from pointer without a cast [-Werror]
> return NULL;
> ^
> cc1: all warnings being treated as errors
>
> Fixed by returning zero.
> ---
> emulator/hciemu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Applied. Thanks.

Interestingly these were previously returning 'bool' instead of 'uint8_t'
which apparently didn't cause this kind of warning.

Johan