Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3271253rwj; Mon, 19 Dec 2022 15:54:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf792iiGPZMF2UyC7PSWurUKr3eMFIWI0z8O45p+v9QhMHBBqghbHMknXwXgiKJ9TSxeUQiE X-Received: by 2002:a17:906:4995:b0:7c1:808e:7660 with SMTP id p21-20020a170906499500b007c1808e7660mr27461586eju.43.1671494043465; Mon, 19 Dec 2022 15:54:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671494043; cv=none; d=google.com; s=arc-20160816; b=W22YcwNOxPtKfYUksJTEQViouqsWvWKE5h3ChqPlM5EG65xdTLVWGKV8Qc1UbH0l7o ySzcos+bevYZcTcDwe4HNoQhUVVITlysG/mh0ytsHHQk38ZPJ2LDCAmViXn2Bl/EjZFc THhvt66asfhJGgMOMNKaUmmaEwlfW/8tfufPS0cOkmDGmzsEbeR+GjCXEAzrGlC9HKhq PVVdAehoMYMiErIlwMDlSxyCvxCdWzcM0AyKcEocBGheGSFrut8JD/nvQZ/uEUuiFRY1 84ceRYpcenJTm2B7S2vhxFzs3mqC5CWjG5g87uGL/W9LP6NQ98ziXxjgjvBpBPpITpME ca9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=LjJAm8zjgdd5gXSrnTXopaA2EFxOOfMU5ePiRT/qcLY=; b=vfA7XDcpJI0K7dt3Do4REC3UNnbPdihWTHVSjXRHnga0dkeWhNuQhU+DqT3lo3KXLG nS+nyuK3CkHHcOBAenLGkLXKnhI8h5QyxnGADOQvm1dLfRh0C4CZn1fDkrct4/gKadqF 8aTeFdJoQERYnQdEykOByXNdlZdub3cW7fIwqDQ8TXzyD3YO7mI9LVATIR8ExTwKn//+ JhlFlwHWux2iHeITAK7pisqJXCG9l7yR/Oa1/WfbeV8MC+tZKn4duMSrrNUO/R7mpouM IifwQ3BfwRQ6Mqb081dM0TL8kpNrzH5c45HI31dc01TSAaRD5yT4gVvyhpFUrcBGdo3t +Q6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XIz5PEA+; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd38-20020a1709076e2600b007aeaacd5592si10514838ejc.124.2022.12.19.15.53.29; Mon, 19 Dec 2022 15:54:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XIz5PEA+; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229963AbiLSXtv (ORCPT + 99 others); Mon, 19 Dec 2022 18:49:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229779AbiLSXtt (ORCPT ); Mon, 19 Dec 2022 18:49:49 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50C6362EF for ; Mon, 19 Dec 2022 15:49:48 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id 7so2220096pga.1 for ; Mon, 19 Dec 2022 15:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=LjJAm8zjgdd5gXSrnTXopaA2EFxOOfMU5ePiRT/qcLY=; b=XIz5PEA+re2FKyyi62yYhKVaH9vjblF3HPmjV2oukSc4WkX7SBYwLpTdu3HINPNNqd fj40bJDPlAZV0FJEBjJIGxpIUgSdpCEILrbRpxFZ/9MRgxDj+/CyygvGMxpaAQd9DKQV UJCao/uE3htVlwc4vhJCyIw6xz8uPi3a7B8FY+Tb+mSFcUkfDZnhdedGyUqtmEvs8M8O ujPXOysnvQkv8Kx09K9fvJHoBk53DNAkh3qrq0TnFxbDG+bh3vbPS571sz87hMoeQC/d Mt1v+muduwqXsC5aS/BtdLyQjt5Ml/gT0G++9/L8H83exRzPZszpnDaRi0JmcBQlYsNh /GWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LjJAm8zjgdd5gXSrnTXopaA2EFxOOfMU5ePiRT/qcLY=; b=2l706+F2d8llBYpQTFTTEYf9qu1y8KwSDsdoPS8bK74byUSe78nOeHU0cObqMGMqmP oNKdpHHboSLD4SEgPE+ki7F4sStvIXUbtmiUPfo12SqPIydLboJUsGIL+oscvijXyys+ UuTngmq/iS2LUo8V/k2ex1FL9axWFa4jwEUwGQJmveB9WqggEYZe8rU6YKRb+Pt6eL30 mk/ItJfl658lDKvpUIRjnItauZdehltQk7kD9BmAw7w/zqvalbD3DImR5TLRWbFoVKkX SZtmg8V7K5qQcoZaMNA48MN2OVRDB1feUOr3yO8gpvNKnq/tjNm8+QS1WXYozz61M9nW cjlQ== X-Gm-Message-State: AFqh2kqD1IBeYp6oGnB6U7x59kvMVaUXLGIC3PgUCoPQJaGgF5dhZ+0O +eyaTA5rO4dvWIsiuSmprnWPPOpaqkaDFg== X-Received: by 2002:a62:1852:0:b0:56e:664f:a5f5 with SMTP id 79-20020a621852000000b0056e664fa5f5mr11967851pfy.8.1671493787270; Mon, 19 Dec 2022 15:49:47 -0800 (PST) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id c205-20020a624ed6000000b005765013d327sm7184881pfb.182.2022.12.19.15.49.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 15:49:46 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2] Bluetooth: hci_sync: Fix use HCI_OP_LE_READ_BUFFER_SIZE_V2 Date: Mon, 19 Dec 2022 15:49:45 -0800 Message-Id: <20221219234945.3733741-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz Don't try to use HCI_OP_LE_READ_BUFFER_SIZE_V2 if controller don't support ISO channels, but in order to check if ISO channels are supported HCI_OP_LE_READ_LOCAL_FEATURES needs to be done earlier so the features bits can be checked on hci_le_read_buffer_size_sync. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216817 Fixes: c1631dbc00c1 ("Bluetooth: hci_sync: Fix hci_read_buffer_size_sync") Signed-off-by: Luiz Augusto von Dentz --- net/bluetooth/hci_sync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index 5220bfd75b00..fcf4a9af3c62 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -3572,7 +3572,7 @@ static const struct hci_init_stage hci_init2[] = { static int hci_le_read_buffer_size_sync(struct hci_dev *hdev) { /* Use Read LE Buffer Size V2 if supported */ - if (hdev->commands[41] & 0x20) + if (iso_capable(hdev) && hdev->commands[41] & 0x20) return __hci_cmd_sync_status(hdev, HCI_OP_LE_READ_BUFFER_SIZE_V2, 0, NULL, HCI_CMD_TIMEOUT); @@ -3597,10 +3597,10 @@ static int hci_le_read_supported_states_sync(struct hci_dev *hdev) /* LE Controller init stage 2 command sequence */ static const struct hci_init_stage le_init2[] = { - /* HCI_OP_LE_READ_BUFFER_SIZE */ - HCI_INIT(hci_le_read_buffer_size_sync), /* HCI_OP_LE_READ_LOCAL_FEATURES */ HCI_INIT(hci_le_read_local_features_sync), + /* HCI_OP_LE_READ_BUFFER_SIZE */ + HCI_INIT(hci_le_read_buffer_size_sync), /* HCI_OP_LE_READ_SUPPORTED_STATES */ HCI_INIT(hci_le_read_supported_states_sync), {} -- 2.37.3