[PATCHv2 06/11] android/gatt: Fix warning by rearranging allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

We need to allocate array of uint8_t so fix allocation parameter, this
also removes unneeded type conversion.

This fixes clang warnings:
...
android/gatt.c:5967:29: warning: Result of 'calloc' is converted to a
pointer of type 'uint8_t', which is incompatible with sizeof operand
type 'uint16_t'
        entry->value = (uint8_t *) new0(uint16_t, 1);
                        ~~~~~~~~~  ^~~~~~~~~~~~~~~~~
./src/shared/util.h:81:26: note: expanded from macro 'new0'
                         ^~~~~~      ~~~~~~~~~
...
---
 android/gatt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/android/gatt.c b/android/gatt.c
index 626a65d..2bef5ab 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5969,7 +5969,7 @@ static void gatt_srvc_change_read_cb(uint16_t handle, uint16_t offset,
 	ccc = bt_get_gatt_ccc(&dev->bdaddr);
 	entry->state = REQUEST_DONE;
 
-	entry->value = (uint8_t *) new0(uint16_t, 1);
+	entry->value = new0(uint8_t, 2);
 	if (!entry->value) {
 		entry->error = ATT_ECODE_INSUFF_RESOURCES;
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux