]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: Simplify / fix return values from tk_request
authorGuenter Roeck <linux@roeck-us.net>
Mon, 6 Apr 2020 18:54:38 +0000 (11:54 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 7 Apr 2020 16:34:53 +0000 (18:34 +0200)
commit7f13a4ac85e775525570bf60d6b2c7a7a4a5f7da
treeefe738dad098341d42165ba2013b011c4280d8dd
parentf964f162588bd8192b69c9b4f8771095aeab41fe
Bluetooth: Simplify / fix return values from tk_request

Some static checker run by 0day reports a variableScope warning.

net/bluetooth/smp.c:870:6: warning:
The scope of the variable 'err' can be reduced. [variableScope]

There is no need for two separate variables holding return values.
Stick with the existing variable. While at it, don't pre-initialize
'ret' because it is set in each code path.

tk_request() is supposed to return a negative error code on errors,
not a bluetooth return code. The calling code converts the return
value to SMP_UNSPECIFIED if needed.

Fixes: a125b148daba ("Bluetooth: Always request for user confirmation for Just Works")
Cc: Sonny Sasaka <sonnysasaka@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
Signed-off-by: Sonny Sasaka <sonnysasaka@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/smp.c