mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amitkumar Karwar <akarwar@marvell.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	Ganapathi Bhat <gbhat@marvell.com>,
	Amitkumar Karwar <akarwar@marvell.com>
Subject: [PATCH v11 2/3] Bluetooth: hci_uart: check if hdev is present before using it
Date: Fri, 6 May 2016 08:31:53 -0700	[thread overview]
Message-ID: <1462548714-7971-2-git-send-email-akarwar@marvell.com> (raw)
In-Reply-To: <1462548714-7971-1-git-send-email-akarwar@marvell.com>

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);
 }
 
-- 
1.8.1.4

  reply	other threads:[~2016-05-06 15:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 15:31 [PATCH v11 1/3] Bluetooth: hci_uart: add prepare callbacks to hci_uart_proto structure Amitkumar Karwar
2016-05-06 15:31 ` Amitkumar Karwar [this message]
2016-06-24  6:01   ` [v11, 2/3] Bluetooth: hci_uart: check if hdev is present before using it Jeffy Chen
2016-05-06 15:31 ` [PATCH v11 3/3] Bluetooth: hci_uart: Support firmware download for Marvell Amitkumar Karwar
2016-05-10 13:59   ` Amitkumar Karwar
2016-05-23  6:06   ` Amitkumar Karwar
2016-06-14  6:35   ` Amitkumar Karwar
2016-06-21  3:47   ` [v11,3/3] " Caesar Wang
2016-06-24  6:02   ` Jeffy Chen
2016-06-27  6:28     ` Amitkumar Karwar
2016-06-30 10:54       ` Loic Poulain
2016-08-09 16:18         ` Amitkumar Karwar
2016-06-24  6:01 ` [v11, 1/3] Bluetooth: hci_uart: add prepare callbacks to hci_uart_proto structure Jeffy Chen

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=1462548714-7971-2-git-send-email-akarwar@marvell.com \
    --to=akarwar@marvell.com \
    --cc=gbhat@marvell.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®