From patchwork Thu Oct 7 11:17:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 12541637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7A0EC433EF for ; Thu, 7 Oct 2021 11:17:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4F4560F59 for ; Thu, 7 Oct 2021 11:17:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232921AbhJGLTL (ORCPT ); Thu, 7 Oct 2021 07:19:11 -0400 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]:33504 "EHLO smtp-relay-canonical-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230087AbhJGLTJ (ORCPT ); Thu, 7 Oct 2021 07:19:09 -0400 Received: from localhost (1.general.cking.uk.vpn [10.172.193.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 303683FFE4; Thu, 7 Oct 2021 11:17:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1633605434; bh=avjKW1lulkmRLzQGJiNan2tRFayMsYMy4bdNSEG99Ds=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=GaMOJdxdCQFYwiz7lh3WZWOecf6ZSKndwxQKMwtsm16R4D4jqcCvmPjGX0jsqseVU kW3R1FwLVxz7JMxgWXB4cY12aoAsATU4D1V3sIEykqtXBOUiWSbiH0Swo1R3VzMbyD 4CjoDRACB4g+if3xci9gNPS9K88sbxQzO5zrKiVyYf0OEAtuV8rq508/kzCP6U+ggy bYxVpX16vfOZPPm7dc61cPy07LVKf/PHbmBLyKSweGMkhr7Zw4qQ536wzHG8Eo1zt6 ypMYa0tMA+h8F24FiKTkufrXVHLyoZ0nuYBc4ijC5B0RP7kg3PhKxfnlQSL29SfQD4 gsxHLeK2/EAkg== From: Colin King To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , "David S . Miller" , Jakub Kicinski , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] Bluetooth: use bitmap_empty to check if a bitmap has any bits set Date: Thu, 7 Oct 2021 12:17:13 +0100 Message-Id: <20211007111713.12207-1-colin.king@canonical.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Colin Ian King The check to see if any tasks are left checks if bitmap array is zero rather than using the appropriate bitmap helper functions to check the bits in the array. Fix this by using bitmap_empty on the bitmap. Addresses-Coverity: (" Array compared against 0") Fixes: 912730b52552 ("Bluetooth: Fix wake up suspend_wait_q prematurely") Signed-off-by: Colin Ian King --- net/bluetooth/hci_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index 209f4fe17237..bad3b9c895ba 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -1108,7 +1108,7 @@ static void suspend_req_complete(struct hci_dev *hdev, u8 status, u16 opcode) clear_bit(SUSPEND_SET_ADV_FILTER, hdev->suspend_tasks); /* Wake up only if there are no tasks left */ - if (!hdev->suspend_tasks) + if (!bitmap_empty(hdev->suspend_tasks, __SUSPEND_NUM_TASKS)) wake_up(&hdev->suspend_wait_q); }