Re: [PATCH 6/7] android/ipc: Use error printing error messages

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

 



Hi Andrei,

On Thursday 17 of April 2014 15:23:50 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>
> 
> This helps to identify problem since DBG is not printed by default.
> ---
>  android/ipc.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/android/ipc.c b/android/ipc.c
> index 8cd34ea..89fff8d 100644
> --- a/android/ipc.c
> +++ b/android/ipc.c
> @@ -96,31 +96,31 @@ static int ipc_handle_msg(struct service_handler *handlers, size_t max_index,
>  	const struct ipc_handler *handler;
>  
>  	if (len < (ssize_t) sizeof(*msg)) {
> -		DBG("message too small (%zd bytes)", len);
> +		error("message too small (%zd bytes)", len);
>  		return -EBADMSG;
>  	}
>  
>  	if (len != (ssize_t) (sizeof(*msg) + msg->len)) {
> -		DBG("message malformed (%zd bytes)", len);
> +		error("message malformed (%zd bytes)", len);
>  		return -EBADMSG;
>  	}
>  
>  	/* if service is valid */
>  	if (msg->service_id > max_index) {
> -		DBG("unknown service (0x%x)", msg->service_id);
> +		error("unknown service (0x%x)", msg->service_id);
>  		return -EOPNOTSUPP;
>  	}
>  
>  	/* if service is registered */
>  	if (!handlers[msg->service_id].handler) {
> -		DBG("service not registered (0x%x)", msg->service_id);
> +		error("service not registered (0x%x)", msg->service_id);
>  		return -EOPNOTSUPP;
>  	}
>  
>  	/* if opcode is valid */
>  	if (msg->opcode == IPC_OP_STATUS ||
>  			msg->opcode > handlers[msg->service_id].size) {
> -		DBG("invalid opcode 0x%x for service 0x%x", msg->opcode,
> +		error("invalid opcode 0x%x for service 0x%x", msg->opcode,
>  							msg->service_id);
>  		return -EOPNOTSUPP;
>  	}
> @@ -131,7 +131,7 @@ static int ipc_handle_msg(struct service_handler *handlers, size_t max_index,
>  	/* if payload size is valid */
>  	if ((handler->var_len && handler->data_len > msg->len) ||
>  			(!handler->var_len && handler->data_len != msg->len)) {
> -		DBG("invalid size for opcode 0x%x service 0x%x",
> +		error("invalid size for opcode 0x%x service 0x%x",
>  						msg->opcode, msg->service_id);
>  		return -EMSGSIZE;
>  	}
> 

I'm fine this change (although we already print error later on based on returned code),
but please prefix those with "IPC: " for clarity.

-- 
Best regards, 
Szymon Janc
--
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