All of lore.kernel.org
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@gmail.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ 04/13] android/hal-avrcp: Add .list_player_app_attr_rsp implementation
Date: Tue, 18 Feb 2014 21:36:42 +0100	[thread overview]
Message-ID: <2008771.ZWhGLGZVZA@athlon> (raw)
In-Reply-To: <1392733470-22736-4-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

On Tuesday 18 February 2014 16:24:21 Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> ---
>  android/hal-avrcp.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/android/hal-avrcp.c b/android/hal-avrcp.c
> index 9937a11..244f77a 100644
> --- a/android/hal-avrcp.c
> +++ b/android/hal-avrcp.c
> @@ -18,6 +18,7 @@
>  #include <stdbool.h>
>  #include <stddef.h>
>  #include <string.h>
> +#include <stdlib.h>
> 
>  #include "hal-log.h"
>  #include "hal.h"
> @@ -74,6 +75,36 @@ static bt_status_t get_play_status_rsp(btrc_play_status_t
> status, sizeof(cmd), &cmd, 0, NULL, NULL);
>  }
> 
> +static bt_status_t list_player_app_attr_rsp(int num_attr,
> +						btrc_player_attr_t *p_attrs)
> +{
> +	struct hal_cmd_avrcp_list_player_attrs *cmd;
> +	bt_status_t status;
> +	size_t len;
> +
> +	DBG("");
> +
> +	if (!interface_ready())
> +		return BT_STATUS_NOT_READY;
> +
> +	if (num_attr < 0)
> +		return BT_STATUS_PARM_INVALID;
> +
> +	len = sizeof(*cmd) + num_attr;
> +	cmd = malloc(len);
> +

We should check for allocation error (highly unlikely though) here and return 
error status. Other option would be to use VLA or fixed size array for buffer.

(same goes for other HAL functions implementations in this serie)

> +	cmd->number = num_attr;
> +	memcpy(cmd->attrs, p_attrs, num_attr);
> +
> +	status =  hal_ipc_cmd(HAL_SERVICE_ID_AVRCP,
> +					HAL_OP_AVRCP_LIST_PLAYER_ATTRS,
> +					len, cmd, 0, NULL, NULL);
> +
> +	free(cmd);
> +
> +	return status;
> +}
> +
>  static void cleanup()
>  {
>  	struct hal_cmd_unregister_module cmd;
> @@ -97,6 +128,7 @@ static btrc_interface_t iface = {
>  	.size = sizeof(iface),
>  	.init = init,
>  	.get_play_status_rsp = get_play_status_rsp,
> +	.list_player_app_attr_rsp = list_player_app_attr_rsp,
>  	.cleanup = cleanup
>  };

-- 
Szymon K. Janc
szymon.janc@gmail.com

  reply	other threads:[~2014-02-18 20:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-18 14:24 [PATCH BlueZ 01/13] android/hal-ipc-api: Add Set Volume command Luiz Augusto von Dentz
2014-02-18 14:24 ` [PATCH BlueZ 02/13] android/avrcp: Add command handlers stubs Luiz Augusto von Dentz
2014-02-18 14:24 ` [PATCH BlueZ 03/13] android/hal-avrcp: Add .get_play_status implementation Luiz Augusto von Dentz
2014-02-18 14:24 ` [PATCH BlueZ 04/13] android/hal-avrcp: Add .list_player_app_attr_rsp implementation Luiz Augusto von Dentz
2014-02-18 20:36   ` Szymon Janc [this message]
2014-02-18 14:24 ` [PATCH BlueZ 05/13] android/hal-avrcp: Add .list_player_app_value_rsp implementation Luiz Augusto von Dentz
2014-02-18 14:24 ` [PATCH BlueZ 06/13] android/hal-avrcp: Add .get_player_app_value_rsp implementation Luiz Augusto von Dentz
2014-02-18 14:24 ` [PATCH BlueZ 07/13] android/hal-avrcp: Add .get_player_app_attr_text_rsp implementation Luiz Augusto von Dentz
2014-02-18 14:24 ` [PATCH BlueZ 08/13] android/hal-avrcp: Add .get_player_app_value_text_rsp implementation Luiz Augusto von Dentz
2014-02-18 14:24 ` [PATCH BlueZ 09/13] android/hal-avrcp: Add .get_element_attr_rsp implementation Luiz Augusto von Dentz
2014-02-18 14:24 ` [PATCH BlueZ 10/13] android/hal-avrcp: Add .set_player_app_value_rsp implementation Luiz Augusto von Dentz
2014-02-18 14:24 ` [PATCH BlueZ 11/13] android/hal-avrcp: Add .register_notification_rsp implementation Luiz Augusto von Dentz
2014-02-18 14:24 ` [PATCH BlueZ 12/13] android/hal-avrcp: Add .set_volume implementation Luiz Augusto von Dentz
2014-02-18 14:24 ` [PATCH BlueZ 13/13] android/hal-avrcp: Add notification handlers Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2008771.ZWhGLGZVZA@athlon \
    --to=szymon.janc@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.