linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] shared/btp: Fix return type in btp_send
@ 2018-02-23 13:40 Szymon Janc
  2018-02-23 13:40 ` [PATCH 2/2] shared/btp: Allow to call btp_send without valid btp Szymon Janc
  2018-02-26 13:00 ` [PATCH 1/2] shared/btp: Fix return type in btp_send Szymon Janc
  0 siblings, 2 replies; 3+ messages in thread
From: Szymon Janc @ 2018-02-23 13:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This function returns bool.
---
 src/shared/btp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/shared/btp.c b/src/shared/btp.c
index 77622671c..555dabc39 100644
--- a/src/shared/btp.c
+++ b/src/shared/btp.c
@@ -297,7 +297,7 @@ bool btp_send(struct btp *btp, uint8_t service, uint8_t opcode, uint8_t index,
 	len = sizeof(*hdr) + length;
 	hdr = l_malloc(len);
 	if (!hdr)
-		return NULL;
+		return false;
 
 	hdr->service = service;
 	hdr->opcode = opcode;
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] shared/btp: Allow to call btp_send without valid btp
  2018-02-23 13:40 [PATCH 1/2] shared/btp: Fix return type in btp_send Szymon Janc
@ 2018-02-23 13:40 ` Szymon Janc
  2018-02-26 13:00 ` [PATCH 1/2] shared/btp: Fix return type in btp_send Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Szymon Janc @ 2018-02-23 13:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This allows to unconditionally call btp_send from code that generates
events eg when mapping those from D-Bus events.
---
 src/shared/btp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/shared/btp.c b/src/shared/btp.c
index 555dabc39..7eea241a2 100644
--- a/src/shared/btp.c
+++ b/src/shared/btp.c
@@ -294,6 +294,9 @@ bool btp_send(struct btp *btp, uint8_t service, uint8_t opcode, uint8_t index,
 	struct pending_message *msg;
 	size_t len;
 
+	if (!btp)
+		return false;
+
 	len = sizeof(*hdr) + length;
 	hdr = l_malloc(len);
 	if (!hdr)
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] shared/btp: Fix return type in btp_send
  2018-02-23 13:40 [PATCH 1/2] shared/btp: Fix return type in btp_send Szymon Janc
  2018-02-23 13:40 ` [PATCH 2/2] shared/btp: Allow to call btp_send without valid btp Szymon Janc
@ 2018-02-26 13:00 ` Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Szymon Janc @ 2018-02-26 13:00 UTC (permalink / raw)
  To: linux-bluetooth

On Friday, 23 February 2018 14:40:09 CET Szymon Janc wrote:
> This function returns bool.
> ---
>  src/shared/btp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/shared/btp.c b/src/shared/btp.c
> index 77622671c..555dabc39 100644
> --- a/src/shared/btp.c
> +++ b/src/shared/btp.c
> @@ -297,7 +297,7 @@ bool btp_send(struct btp *btp, uint8_t service, uint8_t
> opcode, uint8_t index, len = sizeof(*hdr) + length;
>  	hdr = l_malloc(len);
>  	if (!hdr)
> -		return NULL;
> +		return false;
> 
>  	hdr->service = service;
>  	hdr->opcode = opcode;

Applied.

-- 
pozdrawiam
Szymon Janc



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-26 13:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-23 13:40 [PATCH 1/2] shared/btp: Fix return type in btp_send Szymon Janc
2018-02-23 13:40 ` [PATCH 2/2] shared/btp: Allow to call btp_send without valid btp Szymon Janc
2018-02-26 13:00 ` [PATCH 1/2] shared/btp: Fix return type in btp_send Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).