Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1430386 > unrolled thread

Re: [v11, 2/3] Bluetooth: hci_uart: check if hdev is present before using it

Started byJeffy Chen <jeffy.chen@rock-chips.com>
First post2016-06-24 08:10 +0200
Last post2016-06-24 08:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [v11, 2/3] Bluetooth: hci_uart: check if hdev is present before  using it Jeffy Chen <jeffy.chen@rock-chips.com> - 2016-06-24 08:10 +0200

#1430386 — Re: [v11, 2/3] Bluetooth: hci_uart: check if hdev is present before using it

FromJeffy Chen <jeffy.chen@rock-chips.com>
Date2016-06-24 08:10 +0200
SubjectRe: [v11, 2/3] Bluetooth: hci_uart: check if hdev is present before using it
Message-ID<rNstr-4rr-17@gated-at.bofh.it>
On 2016-5-6 23:31, Amitkumar Karwar wrote:
> From: Ganapathi Bhat <gbhat@marvell.com>
>
> The hdev struct might not have initialized in protocol receive handler.
> This patch adds necessary checks.
>
> Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
> ---
>   drivers/bluetooth/hci_ldisc.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
> index b4ee682..047e786 100644
> --- a/drivers/bluetooth/hci_ldisc.c
> +++ b/drivers/bluetooth/hci_ldisc.c
> @@ -154,7 +154,9 @@ restart:
>   
>   		set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
>   		len = tty->ops->write(tty, skb->data, skb->len);
> -		hdev->stat.byte_tx += len;
> +
> +		if (hdev)
> +			hdev->stat.byte_tx += len;
>   
>   		skb_pull(skb, len);
>   		if (skb->len) {
> @@ -349,7 +351,7 @@ void hci_uart_set_baudrate(struct hci_uart *hu, unsigned int speed)
>   	/* tty_set_termios() return not checked as it is always 0 */
>   	tty_set_termios(tty, &ktermios);
>   
> -	BT_DBG("%s: New tty speeds: %d/%d", hu->hdev->name,
> +	BT_DBG("%s: New tty speeds: %d/%d", hu->hdev ? hu->hdev->name : "",
>   	       tty->termios.c_ispeed, tty->termios.c_ospeed);
>   }
>   
>
>
This serial of patches work well on my device...

Tested-by: Jeffy Chen <jeffy.chen@rock-chips.com>

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web