Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5553173pxu; Tue, 22 Dec 2020 22:24:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4tVY1kl5gHdPrTuvktOCm1Rcy0HemGQY/KZpRTbDQ4wTacE2Ct6UXyEkPdKOscAKETwsu X-Received: by 2002:a50:b586:: with SMTP id a6mr23445440ede.206.1608704645671; Tue, 22 Dec 2020 22:24:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608704645; cv=none; d=google.com; s=arc-20160816; b=MICjW9qTk0BrKJ8ECS1krFy6F1qMp3Lpc27pntDdtuMyhd1HX2O/vt4sHlOgHv9UPp iSBa1AJw95Pw5Xf+O7obROIwcgy4xS4ajPieEWP4eQMsJOWN7Zuq1klDulGd4C02/Q20 wUWzchhJi6ewujvIvbP9HqWW+s7jlAkYI5mGhuOyOodpYFe/bFWf28AEpeqhCWTJn0Mp 30Cq2UTTb57nWlErWKGhJXJPXvHqpdW3JFYwF44jWEPwqJ+TZjNMqzaGKpfSMUnMCj36 UI+jBvuLB7WFFmtin30RurnHjt42HSc8TUkjHMtydvOheIIl/6kyF2M8S+KNe8Tygb4w m8Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=qLyNYQQE2DSPmGma0hXkL5oXeW/9i3kVBA9u41FCEGw=; b=n39ZF/hGonc2u/6Ny2NPNlRkwInJrrlfxInyAUOZd2ywXrvLfSqWRI3aDUtcZ8s4SY m/rKn3041ZMtHz1DsMmIFeOYeJhaH84kXHo0K9cvaGytTTYfMBG1IbQvjIJ4m19w2fdw X6bPsvQeMTNh+KCNX6Kvqv4uYwz5Est7R1+3Ahg4kUq0HHHxJZvYjqicHCVynEADxlGb zct0bq7vI9s0AsnpgK2y2S2TOuswnZNlkhbFQZlqn0Fa0LTu3Y6G9k+nHEkrCg4voL7X cSvOdpip97D3YIB4no5WcJFEIho0NRRb8KK0uKWhusJymHbiGLkTuw4cSj8G1mUrRb8X Sncw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si11506355eju.94.2020.12.22.22.23.43; Tue, 22 Dec 2020 22:24:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727396AbgLWGWu (ORCPT + 99 others); Wed, 23 Dec 2020 01:22:50 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:55596 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726969AbgLWGWu (ORCPT ); Wed, 23 Dec 2020 01:22:50 -0500 Received: from [172.20.10.2] (tmo-108-60.customers.d1-online.com [80.187.108.60]) by mail.holtmann.org (Postfix) with ESMTPSA id 63BB2CECD2; Wed, 23 Dec 2020 07:29:25 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: [PATCH] Bluetooth: btrtl: Add null check in setup From: Marcel Holtmann In-Reply-To: <20201222184753.1.I9438ef1f79fa1132e74c67b489123291080b9a8c@changeid> Date: Wed, 23 Dec 2020 07:22:06 +0100 Cc: CrosBT Upstreaming , linux-bluetooth , Johan Hedberg , Daniel Winkler , LKML , Luiz Augusto von Dentz Content-Transfer-Encoding: 7bit Message-Id: <2CD614F7-0E7D-4BC2-AF81-50A1962DC760@holtmann.org> References: <20201222184753.1.I9438ef1f79fa1132e74c67b489123291080b9a8c@changeid> To: Abhishek Pandit-Subedi X-Mailer: Apple Mail (2.3654.40.0.2.32) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Abhishek, > btrtl_dev->ic_info is only available from the controller on cold boot > (the lmp subversion matches the device model and this is used to look up > the ic_info). On warm boots (firmware already loaded), > btrtl_dev->ic_info is null. > > Fixes: 05672a2c14a4 (Bluetooth: btrtl: Enable central-peripheral role) > Signed-off-by: Abhishek Pandit-Subedi > --- > > drivers/bluetooth/btrtl.c | 23 +++++++++++++---------- > 1 file changed, 13 insertions(+), 10 deletions(-) > > diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c > index 1abf6a4d672734f..978f3c773856b05 100644 > --- a/drivers/bluetooth/btrtl.c > +++ b/drivers/bluetooth/btrtl.c > @@ -719,16 +719,19 @@ int btrtl_setup_realtek(struct hci_dev *hdev) > */ > set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); > > - /* Enable central-peripheral role (able to create new connections with > - * an existing connection in slave role). > - */ > - switch (btrtl_dev->ic_info->lmp_subver) { > - case RTL_ROM_LMP_8822B: > - set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); > - break; > - default: > - rtl_dev_dbg(hdev, "Central-peripheral role not enabled."); > - break; > + if (btrtl_dev->ic_info) { > + /* Enable central-peripheral role (able to create new > + * connections with an existing connection in slave role). > + */ > + switch (btrtl_dev->ic_info->lmp_subver) { > + case RTL_ROM_LMP_8822B: > + set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); > + break; > + default: > + rtl_dev_dbg(hdev, > + "Central-peripheral role not enabled."); > + break; > + } > } if (!btrtl_dev->ic_info) goto done; > > btrtl_free(btrtl_dev); Regards Marcel