From mboxrd@z Thu Jan 1 00:00:00 1970 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 3E629C433FE for ; Thu, 7 Oct 2021 15:47:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B45061074 for ; Thu, 7 Oct 2021 15:47:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241837AbhJGPti convert rfc822-to-8bit (ORCPT ); Thu, 7 Oct 2021 11:49:38 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:39927 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232870AbhJGPth (ORCPT ); Thu, 7 Oct 2021 11:49:37 -0400 Received: from smtpclient.apple (p5b3d2185.dip0.t-ipconnect.de [91.61.33.133]) by mail.holtmann.org (Postfix) with ESMTPSA id A8422CECE5; Thu, 7 Oct 2021 17:47:41 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: [PATCH][next] Bluetooth: use bitmap_empty to check if a bitmap has any bits set From: Marcel Holtmann In-Reply-To: Date: Thu, 7 Oct 2021 17:47:41 +0200 Cc: Colin King , Johan Hedberg , "David S. Miller" , Jakub Kicinski , "linux-bluetooth@vger.kernel.org" , "open list:NETWORKING [GENERAL]" , kernel-janitors@vger.kernel.org, Linux Kernel Mailing List Content-Transfer-Encoding: 8BIT Message-Id: <888C3A95-5410-4B53-8805-4BAE9A9E6010@holtmann.org> References: <20211007111713.12207-1-colin.king@canonical.com> To: Luiz Augusto von Dentz X-Mailer: Apple Mail (2.3654.120.0.1.13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Luiz, >> 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); >> } >> >> -- >> 2.32.0 > > I was going to revert this change since it appears wake_up does > actually check the wake condition there is no premature wake up after > all. so should I take the patch "Fix wake up suspend_wait_q prematurelyā€¯ completely out? Regards Marcel