Bluetooth: SMP: Fix variable dereferenced before check 'conn'

This fixes kbuild findings:

smatch warnings:
net/bluetooth/smp.c:1633 smp_user_confirm_reply() warn: variable
dereferenced before check 'conn' (see line 1631)

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Luiz Augusto von Dentz 2021-03-29 10:27:04 -07:00 committed by Marcel Holtmann
parent 06752d1678
commit 0ae8ef674e

View File

@ -1628,11 +1628,11 @@ int smp_user_confirm_reply(struct hci_conn *hcon, u16 mgmt_op, __le32 passkey)
u32 value;
int err;
bt_dev_dbg(conn->hcon->hdev, "");
if (!conn)
return -ENOTCONN;
bt_dev_dbg(conn->hcon->hdev, "");
chan = conn->smp;
if (!chan)
return -ENOTCONN;