audio/avrcp: Fix uninitialized variable
This fixes the following error:
profiles/audio/avrcp.c:2847:6: error: variable 'num_of_items' is used
uninitialized whenever 'if' condition is true
[-Werror,-Wsometimes-uninitialized]
if (pdu->params[0] == AVRCP_STATUS_OUT_OF_BOUNDS)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/avrcp.c:2857:40: note: uninitialized use occurs here
media_player_total_items_complete(mp, num_of_items);
^~~~~~~~~~~~
profiles/audio/avrcp.c:2847:2: note: remove the 'if' if its condition is always
false
if (pdu->params[0] == AVRCP_STATUS_OUT_OF_BOUNDS)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/avrcp.c:2839:23: note: initialize the variable 'num_of_items' to
silence this warning
uint32_t num_of_items;
^
= 0
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 37bc291..70c184b 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -3112,7 +3112,7 @@
struct avrcp *session = user_data;
struct avrcp_player *player = session->controller->player;
struct media_player *mp = player->user_data;
- uint32_t num_of_items;
+ uint32_t num_of_items = 0;
if (pdu == NULL)
return -ETIMEDOUT;