emulator: Fix condition check in btdev_create()
authorInga Stotland <inga.stotland@intel.com>
Thu, 4 Jul 2019 07:01:10 +0000 (00:01 -0700)
committerhimanshu <h.himanshu@samsung.com>
Tue, 11 Feb 2020 08:57:47 +0000 (14:27 +0530)
This fixes a case where logical '||' was used with constant operand
and the condition check always resulted in true.

Was: if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
                                        || BTDEV_TYPE_BREDRLE50)
Fixed: if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
                                        || type == BTDEV_TYPE_BREDRLE50)

Change-Id: If8730ed0e30a0b9508a7e9591e3f63cc3deecff9
Signed-off-by: himanshu <h.himanshu@samsung.com>
emulator/btdev.c

index f4c79c2..38d5b3b 100755 (executable)
@@ -645,7 +645,7 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id)
        memset(btdev, 0, sizeof(*btdev));
 
        if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
-                               || BTDEV_TYPE_BREDRLE50) {
+                               || type == BTDEV_TYPE_BREDRLE50) {
                btdev->crypto = bt_crypto_new();
                if (!btdev->crypto) {
                        free(btdev);