drivers/nble: Fix NULL dereferencing

Fixes dereferencing NULL calling not defined function. Fixes PTS test
TC_GAW_CL_BV_01_C which was failing with the trace:

...
bt: on_nble_gattc_write_rsp (0xa80099e4): conn 0xa8008f60 status 0
***** CPU exception 6
Current thread ID = 0xa80099e4
Faulting segment:address = 0x00000008:0x40000000
eax: 0xa8008f60, ebx: 0xa8008f60, ecx: 0x00000000, edx: 0x00000000
esi: 0xa8009f88, edi: 0x00000000, ebp: 0a8009f80, esp: 0xa8009f70
eflags: 0x00010247
Fatal fiber error! Aborting fiber.
...

Change-Id: Ia76c2ad816e6427b353ab245855a1959c23c5feb
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
Andrei Emeltchenko 2016-05-30 10:21:15 +03:00 committed by Johan Hedberg
parent 515ec20a06
commit 979e10de6f

View file

@ -1104,7 +1104,9 @@ void on_nble_gattc_write_rsp(const struct nble_gattc_write_rsp *rsp)
func = ((struct bt_gatt_write_params *)private)->func;
}
func(conn, rsp->status);
if (func) {
func(conn, rsp->status);
}
bt_conn_unref(conn);
}