public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions
@ 2024-07-31 15:20 Bartosz Golaszewski
  2024-07-31 15:20 ` [PATCH 1/3] Bluetooth: hci_qca: don't call pwrseq_power_off() twice for QCA6390 Bartosz Golaszewski
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2024-07-31 15:20 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, Wren Turkal,
	Dmitry Baryshkov
  Cc: Luiz Augusto von Dentz, linux-bluetooth, linux-kernel,
	Bartosz Golaszewski

Here are the fixes for regressions reported by Wren and Dmitry. I could
reproduce the crash on db820c and so I was able to test it but patch 2/3
could use a Tested-by from Wren on QCA6390.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
Bartosz Golaszewski (3):
      Bluetooth: hci_qca: don't call pwrseq_power_off() twice for QCA6390
      Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms
      Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown

 drivers/bluetooth/hci_qca.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
---
base-commit: cd19ac2f903276b820f5d0d89de0c896c27036ed
change-id: 20240731-hci_qca_fixes-8e7a8ed3ad83

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/3] Bluetooth: hci_qca: don't call pwrseq_power_off() twice for QCA6390
  2024-07-31 15:20 [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions Bartosz Golaszewski
@ 2024-07-31 15:20 ` Bartosz Golaszewski
  2024-07-31 15:20 ` [PATCH 2/3] Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms Bartosz Golaszewski
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2024-07-31 15:20 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, Wren Turkal,
	Dmitry Baryshkov
  Cc: Luiz Augusto von Dentz, linux-bluetooth, linux-kernel,
	Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Now that we call pwrseq_power_off() for all models that hold a valid
power sequencing handle, we can remove the switch case for QCA_6390. The
switch will now use the default label for this model but that's fine: if
it has the BT-enable GPIO than we should use it.

Fixes: eba1718717b0 ("Bluetooth: hci_qca: make pwrseq calls the default if available")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/bluetooth/hci_qca.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index ca6466676902..a20dd5015346 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2187,10 +2187,6 @@ static void qca_power_shutdown(struct hci_uart *hu)
 		}
 		break;
 
-	case QCA_QCA6390:
-		pwrseq_power_off(qcadev->bt_power->pwrseq);
-		break;
-
 	default:
 		gpiod_set_value_cansleep(qcadev->bt_en, 0);
 	}

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/3] Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms
  2024-07-31 15:20 [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions Bartosz Golaszewski
  2024-07-31 15:20 ` [PATCH 1/3] Bluetooth: hci_qca: don't call pwrseq_power_off() twice for QCA6390 Bartosz Golaszewski
@ 2024-07-31 15:20 ` Bartosz Golaszewski
  2024-08-01  7:29   ` Paul Menzel
  2024-08-07 19:09   ` Wren Turkal
  2024-07-31 15:20 ` [PATCH 3/3] Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown Bartosz Golaszewski
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2024-07-31 15:20 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, Wren Turkal,
	Dmitry Baryshkov
  Cc: Luiz Augusto von Dentz, linux-bluetooth, linux-kernel,
	Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

QCA6390 can albo be used on non-DT systems so we must not make the power
sequencing the only option. Check if the serdev device consumes an OF
node. If so: honor the new contract as per the DT bindings. If not: fall
back to the previous behavior by falling through to the existing
default label.

Fixes: 9a15ce685706 ("Bluetooth: qca: use the power sequencer for QCA6390")
Reported-by: Wren Turkal <wt@penguintechs.org>
Closes: https://lore.kernel.org/linux-bluetooth/27e6a6c5-fb63-4219-be0b-eefa2c116e06@penguintechs.org/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/bluetooth/hci_qca.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index a20dd5015346..2baed7d0f479 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2412,11 +2412,14 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 		break;
 
 	case QCA_QCA6390:
-		qcadev->bt_power->pwrseq = devm_pwrseq_get(&serdev->dev,
-							   "bluetooth");
-		if (IS_ERR(qcadev->bt_power->pwrseq))
-			return PTR_ERR(qcadev->bt_power->pwrseq);
-		break;
+		if (dev_of_node(&serdev->dev)) {
+			qcadev->bt_power->pwrseq = devm_pwrseq_get(&serdev->dev,
+								   "bluetooth");
+			if (IS_ERR(qcadev->bt_power->pwrseq))
+				return PTR_ERR(qcadev->bt_power->pwrseq);
+			break;
+		}
+		fallthrough;
 
 	default:
 		qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/3] Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown
  2024-07-31 15:20 [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions Bartosz Golaszewski
  2024-07-31 15:20 ` [PATCH 1/3] Bluetooth: hci_qca: don't call pwrseq_power_off() twice for QCA6390 Bartosz Golaszewski
  2024-07-31 15:20 ` [PATCH 2/3] Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms Bartosz Golaszewski
@ 2024-07-31 15:20 ` Bartosz Golaszewski
  2024-08-06 22:44   ` Nícolas F. R. A. Prado
  2024-07-31 16:32 ` [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions Luiz Augusto von Dentz
  2024-08-01  8:20 ` patchwork-bot+bluetooth
  4 siblings, 1 reply; 16+ messages in thread
From: Bartosz Golaszewski @ 2024-07-31 15:20 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, Wren Turkal,
	Dmitry Baryshkov
  Cc: Luiz Augusto von Dentz, linux-bluetooth, linux-kernel,
	Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Unlike qca_regulator_init(), qca_power_shutdown() may be called for
QCA_ROME which does not have qcadev->bt_power assigned. Add a
NULL-pointer check before dereferencing the struct qca_power pointer.

Fixes: eba1718717b0 ("Bluetooth: hci_qca: make pwrseq calls the default if available")
Reported-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Closes: https://lore.kernel.org/linux-bluetooth/su3wp6s44hrxf4ijvsdfzbvv4unu4ycb7kkvwbx6ltdafkldir@4g7ydqm2ap5j/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/bluetooth/hci_qca.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 2baed7d0f479..45adc1560d94 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2160,7 +2160,7 @@ static void qca_power_shutdown(struct hci_uart *hu)
 	qcadev = serdev_device_get_drvdata(hu->serdev);
 	power = qcadev->bt_power;
 
-	if (power->pwrseq) {
+	if (power && power->pwrseq) {
 		pwrseq_power_off(power->pwrseq);
 		set_bit(QCA_BT_OFF, &qca->flags);
 		return;

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions
  2024-07-31 15:20 [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions Bartosz Golaszewski
                   ` (2 preceding siblings ...)
  2024-07-31 15:20 ` [PATCH 3/3] Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown Bartosz Golaszewski
@ 2024-07-31 16:32 ` Luiz Augusto von Dentz
  2024-08-01  3:57   ` Wren Turkal
  2024-08-01  8:20 ` patchwork-bot+bluetooth
  4 siblings, 1 reply; 16+ messages in thread
From: Luiz Augusto von Dentz @ 2024-07-31 16:32 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Marcel Holtmann, Wren Turkal, Dmitry Baryshkov,
	Luiz Augusto von Dentz, linux-bluetooth, linux-kernel,
	Bartosz Golaszewski

Hi Wren,

On Wed, Jul 31, 2024 at 11:21 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> Here are the fixes for regressions reported by Wren and Dmitry. I could
> reproduce the crash on db820c and so I was able to test it but patch 2/3
> could use a Tested-by from Wren on QCA6390.

Can you give this set a try and report back?

> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> Bartosz Golaszewski (3):
>       Bluetooth: hci_qca: don't call pwrseq_power_off() twice for QCA6390
>       Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms
>       Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown
>
>  drivers/bluetooth/hci_qca.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> ---
> base-commit: cd19ac2f903276b820f5d0d89de0c896c27036ed
> change-id: 20240731-hci_qca_fixes-8e7a8ed3ad83
>
> Best regards,
> --
> Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions
  2024-07-31 16:32 ` [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions Luiz Augusto von Dentz
@ 2024-08-01  3:57   ` Wren Turkal
  2024-08-01  7:23     ` Wren Turkal
  0 siblings, 1 reply; 16+ messages in thread
From: Wren Turkal @ 2024-08-01  3:57 UTC (permalink / raw)
  To: Luiz Augusto von Dentz, Bartosz Golaszewski
  Cc: Marcel Holtmann, Dmitry Baryshkov, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, Bartosz Golaszewski

Luiz and Bartosz,

On 7/31/24 9:32 AM, Luiz Augusto von Dentz wrote:
> Hi Wren,
> 
> On Wed, Jul 31, 2024 at 11:21 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>>
>> Here are the fixes for regressions reported by Wren and Dmitry. I could
>> reproduce the crash on db820c and so I was able to test it but patch 2/3
>> could use a Tested-by from Wren on QCA6390.
> 
> Can you give this set a try and report back?

I'll give it a shot tonight or tomorrow and report back.

Bartosz, thanks for looking into this.

>> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>> ---
>> Bartosz Golaszewski (3):
>>        Bluetooth: hci_qca: don't call pwrseq_power_off() twice for QCA6390
>>        Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms
>>        Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown
>>
>>   drivers/bluetooth/hci_qca.c | 19 +++++++++----------
>>   1 file changed, 9 insertions(+), 10 deletions(-)
>> ---
>> base-commit: cd19ac2f903276b820f5d0d89de0c896c27036ed
>> change-id: 20240731-hci_qca_fixes-8e7a8ed3ad83
>>
>> Best regards,
>> --
>> Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>>
> 
> 

-- 
You're more amazing than you think!


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions
  2024-08-01  3:57   ` Wren Turkal
@ 2024-08-01  7:23     ` Wren Turkal
  0 siblings, 0 replies; 16+ messages in thread
From: Wren Turkal @ 2024-08-01  7:23 UTC (permalink / raw)
  To: Luiz Augusto von Dentz, Bartosz Golaszewski
  Cc: Marcel Holtmann, Dmitry Baryshkov, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, Bartosz Golaszewski

Bartosz,

On 7/31/24 8:57 PM, Wren Turkal wrote:
> Luiz and Bartosz,
> 
> On 7/31/24 9:32 AM, Luiz Augusto von Dentz wrote:
>> Hi Wren,
>>
>> On Wed, Jul 31, 2024 at 11:21 AM Bartosz Golaszewski <brgl@bgdev.pl> 
>> wrote:
>>>
>>> Here are the fixes for regressions reported by Wren and Dmitry. I could
>>> reproduce the crash on db820c and so I was able to test it but patch 2/3
>>> could use a Tested-by from Wren on QCA6390.
>>
>> Can you give this set a try and report back?
> 
> I'll give it a shot tonight or tomorrow and report back.
> 
> Bartosz, thanks for looking into this.
> 
>>> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>>> ---
>>> Bartosz Golaszewski (3):
>>>        Bluetooth: hci_qca: don't call pwrseq_power_off() twice for 
>>> QCA6390
>>>        Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms
>>>        Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown
>>>
>>>   drivers/bluetooth/hci_qca.c | 19 +++++++++----------
>>>   1 file changed, 9 insertions(+), 10 deletions(-)
>>> ---
>>> base-commit: cd19ac2f903276b820f5d0d89de0c896c27036ed
>>> change-id: 20240731-hci_qca_fixes-8e7a8ed3ad83
>>>
>>> Best regards,
>>> -- 
>>> Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>>>
>>
>>
> 

+Tested-by: Wren Turkal <wt@penguintechs.org>

It works. Thanks for chasing this down.

wt
-- 
You're more amazing than you think!


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms
  2024-07-31 15:20 ` [PATCH 2/3] Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms Bartosz Golaszewski
@ 2024-08-01  7:29   ` Paul Menzel
  2024-08-01  7:39     ` Bartosz Golaszewski
  2024-08-07 19:09   ` Wren Turkal
  1 sibling, 1 reply; 16+ messages in thread
From: Paul Menzel @ 2024-08-01  7:29 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Wren Turkal,
	Dmitry Baryshkov, Luiz Augusto von Dentz, linux-bluetooth,
	linux-kernel, Bartosz Golaszewski

Dear Bartosz,


Thank you for the patch.

Am 31.07.24 um 17:20 schrieb Bartosz Golaszewski:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> QCA6390 can albo be used on non-DT systems so we must not make the power

al*s*o

> sequencing the only option. Check if the serdev device consumes an OF
> node. If so: honor the new contract as per the DT bindings. If not: fall
> back to the previous behavior by falling through to the existing
> default label.
> 
> Fixes: 9a15ce685706 ("Bluetooth: qca: use the power sequencer for QCA6390")
> Reported-by: Wren Turkal <wt@penguintechs.org>
> Closes: https://lore.kernel.org/linux-bluetooth/27e6a6c5-fb63-4219-be0b-eefa2c116e06@penguintechs.org/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>   drivers/bluetooth/hci_qca.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index a20dd5015346..2baed7d0f479 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -2412,11 +2412,14 @@ static int qca_serdev_probe(struct serdev_device *serdev)
>   		break;
>   
>   	case QCA_QCA6390:
> -		qcadev->bt_power->pwrseq = devm_pwrseq_get(&serdev->dev,
> -							   "bluetooth");
> -		if (IS_ERR(qcadev->bt_power->pwrseq))
> -			return PTR_ERR(qcadev->bt_power->pwrseq);
> -		break;
> +		if (dev_of_node(&serdev->dev)) {
> +			qcadev->bt_power->pwrseq = devm_pwrseq_get(&serdev->dev,
> +								   "bluetooth");
> +			if (IS_ERR(qcadev->bt_power->pwrseq))
> +				return PTR_ERR(qcadev->bt_power->pwrseq);
> +			break;
> +		}
> +		fallthrough;
>   
>   	default:
>   		qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms
  2024-08-01  7:29   ` Paul Menzel
@ 2024-08-01  7:39     ` Bartosz Golaszewski
  0 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2024-08-01  7:39 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: Marcel Holtmann, Wren Turkal, Dmitry Baryshkov,
	Luiz Augusto von Dentz, linux-bluetooth, linux-kernel,
	Bartosz Golaszewski, Paul Menzel

On Thu, Aug 1, 2024 at 9:29 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
>
> Dear Bartosz,
>
>
> Thank you for the patch.
>
> Am 31.07.24 um 17:20 schrieb Bartosz Golaszewski:
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > QCA6390 can albo be used on non-DT systems so we must not make the power
>
> al*s*o
>

Luiz: Can you fix this when applying?

Bart

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions
  2024-07-31 15:20 [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions Bartosz Golaszewski
                   ` (3 preceding siblings ...)
  2024-07-31 16:32 ` [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions Luiz Augusto von Dentz
@ 2024-08-01  8:20 ` patchwork-bot+bluetooth
  4 siblings, 0 replies; 16+ messages in thread
From: patchwork-bot+bluetooth @ 2024-08-01  8:20 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: marcel, luiz.dentz, wt, dmitry.baryshkov, luiz.von.dentz,
	linux-bluetooth, linux-kernel, bartosz.golaszewski

Hello:

This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed, 31 Jul 2024 17:20:47 +0200 you wrote:
> Here are the fixes for regressions reported by Wren and Dmitry. I could
> reproduce the crash on db820c and so I was able to test it but patch 2/3
> could use a Tested-by from Wren on QCA6390.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> Bartosz Golaszewski (3):
>       Bluetooth: hci_qca: don't call pwrseq_power_off() twice for QCA6390
>       Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms
>       Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown
> 
> [...]

Here is the summary with links:
  - [1/3] Bluetooth: hci_qca: don't call pwrseq_power_off() twice for QCA6390
    https://git.kernel.org/bluetooth/bluetooth-next/c/3c9b2c902da0
  - [2/3] Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms
    https://git.kernel.org/bluetooth/bluetooth-next/c/786cd197c92b
  - [3/3] Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown
    https://git.kernel.org/bluetooth/bluetooth-next/c/9fba2e3f4ac1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/3] Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown
  2024-07-31 15:20 ` [PATCH 3/3] Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown Bartosz Golaszewski
@ 2024-08-06 22:44   ` Nícolas F. R. A. Prado
  2024-08-07  7:53     ` Bartosz Golaszewski
  0 siblings, 1 reply; 16+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-08-06 22:44 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Wren Turkal,
	Dmitry Baryshkov, Luiz Augusto von Dentz, linux-bluetooth,
	linux-kernel, Bartosz Golaszewski

On Wed, Jul 31, 2024 at 05:20:50PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> Unlike qca_regulator_init(), qca_power_shutdown() may be called for
> QCA_ROME which does not have qcadev->bt_power assigned. Add a
> NULL-pointer check before dereferencing the struct qca_power pointer.
> 
> Fixes: eba1718717b0 ("Bluetooth: hci_qca: make pwrseq calls the default if available")
> Reported-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Closes: https://lore.kernel.org/linux-bluetooth/su3wp6s44hrxf4ijvsdfzbvv4unu4ycb7kkvwbx6ltdafkldir@4g7ydqm2ap5j/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Hi,

I just noticed we're still hitting this issue in mainline (saw it on the
mt8183-juniper platform in KernelCI). I see this commit was merged 6 days ago to
bluetooth-next, but it seems there wasn't a pull request with this fix yet to
include it in 6.11. I'm wondering if it's still going to be sent.

Thanks,
Nícolas

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/3] Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown
  2024-08-06 22:44   ` Nícolas F. R. A. Prado
@ 2024-08-07  7:53     ` Bartosz Golaszewski
  2024-08-07 15:03       ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 16+ messages in thread
From: Bartosz Golaszewski @ 2024-08-07  7:53 UTC (permalink / raw)
  To: Nícolas F. R. A. Prado, Luiz Augusto von Dentz,
	Luiz Augusto von Dentz, Marcel Holtmann
  Cc: Wren Turkal, Dmitry Baryshkov, linux-bluetooth, linux-kernel,
	Bartosz Golaszewski

On Wed, Aug 7, 2024 at 12:44 AM Nícolas F. R. A. Prado
<nfraprado@collabora.com> wrote:
>
> On Wed, Jul 31, 2024 at 05:20:50PM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > Unlike qca_regulator_init(), qca_power_shutdown() may be called for
> > QCA_ROME which does not have qcadev->bt_power assigned. Add a
> > NULL-pointer check before dereferencing the struct qca_power pointer.
> >
> > Fixes: eba1718717b0 ("Bluetooth: hci_qca: make pwrseq calls the default if available")
> > Reported-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > Closes: https://lore.kernel.org/linux-bluetooth/su3wp6s44hrxf4ijvsdfzbvv4unu4ycb7kkvwbx6ltdafkldir@4g7ydqm2ap5j/
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Hi,
>
> I just noticed we're still hitting this issue in mainline (saw it on the
> mt8183-juniper platform in KernelCI). I see this commit was merged 6 days ago to
> bluetooth-next, but it seems there wasn't a pull request with this fix yet to
> include it in 6.11. I'm wondering if it's still going to be sent.
>
> Thanks,
> Nícolas

The patches are in next so I don't see why they wouldn't be sent upstream.

Moving Luiz and Marcel to To: to make sure they see this message.

Bart

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/3] Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown
  2024-08-07  7:53     ` Bartosz Golaszewski
@ 2024-08-07 15:03       ` Luiz Augusto von Dentz
  2024-08-07 18:34         ` Nícolas F. R. A. Prado
  0 siblings, 1 reply; 16+ messages in thread
From: Luiz Augusto von Dentz @ 2024-08-07 15:03 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Nícolas F. R. A. Prado, Luiz Augusto von Dentz,
	Marcel Holtmann, Wren Turkal, Dmitry Baryshkov, linux-bluetooth,
	linux-kernel, Bartosz Golaszewski

Hi Bartosz, Nicolas,

On Wed, Aug 7, 2024 at 3:53 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> On Wed, Aug 7, 2024 at 12:44 AM Nícolas F. R. A. Prado
> <nfraprado@collabora.com> wrote:
> >
> > On Wed, Jul 31, 2024 at 05:20:50PM +0200, Bartosz Golaszewski wrote:
> > > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > >
> > > Unlike qca_regulator_init(), qca_power_shutdown() may be called for
> > > QCA_ROME which does not have qcadev->bt_power assigned. Add a
> > > NULL-pointer check before dereferencing the struct qca_power pointer.
> > >
> > > Fixes: eba1718717b0 ("Bluetooth: hci_qca: make pwrseq calls the default if available")
> > > Reported-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > > Closes: https://lore.kernel.org/linux-bluetooth/su3wp6s44hrxf4ijvsdfzbvv4unu4ycb7kkvwbx6ltdafkldir@4g7ydqm2ap5j/
> > > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > Hi,
> >
> > I just noticed we're still hitting this issue in mainline (saw it on the
> > mt8183-juniper platform in KernelCI). I see this commit was merged 6 days ago to
> > bluetooth-next, but it seems there wasn't a pull request with this fix yet to
> > include it in 6.11. I'm wondering if it's still going to be sent.
> >
> > Thanks,
> > Nícolas
>
> The patches are in next so I don't see why they wouldn't be sent upstream.
>
> Moving Luiz and Marcel to To: to make sure they see this message.

I was on a business trip last week, will prepare the pull request later today.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/3] Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown
  2024-08-07 15:03       ` Luiz Augusto von Dentz
@ 2024-08-07 18:34         ` Nícolas F. R. A. Prado
  0 siblings, 0 replies; 16+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-08-07 18:34 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: Bartosz Golaszewski, Luiz Augusto von Dentz, Marcel Holtmann,
	Wren Turkal, Dmitry Baryshkov, linux-bluetooth, linux-kernel,
	Bartosz Golaszewski

On Wed, Aug 07, 2024 at 11:03:09AM -0400, Luiz Augusto von Dentz wrote:
> Hi Bartosz, Nicolas,
> 
> On Wed, Aug 7, 2024 at 3:53 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > On Wed, Aug 7, 2024 at 12:44 AM Nícolas F. R. A. Prado
> > <nfraprado@collabora.com> wrote:
> > >
> > > On Wed, Jul 31, 2024 at 05:20:50PM +0200, Bartosz Golaszewski wrote:
> > > > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > > >
> > > > Unlike qca_regulator_init(), qca_power_shutdown() may be called for
> > > > QCA_ROME which does not have qcadev->bt_power assigned. Add a
> > > > NULL-pointer check before dereferencing the struct qca_power pointer.
> > > >
> > > > Fixes: eba1718717b0 ("Bluetooth: hci_qca: make pwrseq calls the default if available")
> > > > Reported-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > > > Closes: https://lore.kernel.org/linux-bluetooth/su3wp6s44hrxf4ijvsdfzbvv4unu4ycb7kkvwbx6ltdafkldir@4g7ydqm2ap5j/
> > > > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > >
> > > Hi,
> > >
> > > I just noticed we're still hitting this issue in mainline (saw it on the
> > > mt8183-juniper platform in KernelCI). I see this commit was merged 6 days ago to
> > > bluetooth-next, but it seems there wasn't a pull request with this fix yet to
> > > include it in 6.11. I'm wondering if it's still going to be sent.
> > >
> > > Thanks,
> > > Nícolas
> >
> > The patches are in next so I don't see why they wouldn't be sent upstream.
> >
> > Moving Luiz and Marcel to To: to make sure they see this message.
> 
> I was on a business trip last week, will prepare the pull request later today.

Sounds good. And sorry for bothering you about this, I just wanted to make sure
the fix was headed to 6.11.

Thanks,
Nícolas

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms
  2024-07-31 15:20 ` [PATCH 2/3] Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms Bartosz Golaszewski
  2024-08-01  7:29   ` Paul Menzel
@ 2024-08-07 19:09   ` Wren Turkal
  2024-08-08  7:49     ` Bartosz Golaszewski
  1 sibling, 1 reply; 16+ messages in thread
From: Wren Turkal @ 2024-08-07 19:09 UTC (permalink / raw)
  To: Bartosz Golaszewski, Marcel Holtmann, Luiz Augusto von Dentz,
	Dmitry Baryshkov
  Cc: Luiz Augusto von Dentz, linux-bluetooth, linux-kernel,
	Bartosz Golaszewski

On 7/31/24 8:20 AM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> QCA6390 can albo be used on non-DT systems so we must not make the power
> sequencing the only option. Check if the serdev device consumes an OF
> node. If so: honor the new contract as per the DT bindings. If not: fall
> back to the previous behavior by falling through to the existing
> default label.
> 
> Fixes: 9a15ce685706 ("Bluetooth: qca: use the power sequencer for QCA6390")
> Reported-by: Wren Turkal <wt@penguintechs.org>
> Closes: https://lore.kernel.org/linux-bluetooth/27e6a6c5-fb63-4219-be0b-eefa2c116e06@penguintechs.org/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Was this commit supposed to have a Tested-by: footer for me?

> ---
>   drivers/bluetooth/hci_qca.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index a20dd5015346..2baed7d0f479 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -2412,11 +2412,14 @@ static int qca_serdev_probe(struct serdev_device *serdev)
>   		break;
>   
>   	case QCA_QCA6390:
> -		qcadev->bt_power->pwrseq = devm_pwrseq_get(&serdev->dev,
> -							   "bluetooth");
> -		if (IS_ERR(qcadev->bt_power->pwrseq))
> -			return PTR_ERR(qcadev->bt_power->pwrseq);
> -		break;
> +		if (dev_of_node(&serdev->dev)) {
> +			qcadev->bt_power->pwrseq = devm_pwrseq_get(&serdev->dev,
> +								   "bluetooth");
> +			if (IS_ERR(qcadev->bt_power->pwrseq))
> +				return PTR_ERR(qcadev->bt_power->pwrseq);
> +			break;
> +		}
> +		fallthrough;
>   
>   	default:
>   		qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
> 

-- 
You're more amazing than you think!


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms
  2024-08-07 19:09   ` Wren Turkal
@ 2024-08-08  7:49     ` Bartosz Golaszewski
  0 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2024-08-08  7:49 UTC (permalink / raw)
  To: Wren Turkal
  Cc: Bartosz Golaszewski, Marcel Holtmann, Luiz Augusto von Dentz,
	Dmitry Baryshkov, Luiz Augusto von Dentz, linux-bluetooth,
	linux-kernel

On Wed, 7 Aug 2024 at 21:09, Wren Turkal <wt@penguintechs.org> wrote:
>
> On 7/31/24 8:20 AM, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > QCA6390 can albo be used on non-DT systems so we must not make the power
> > sequencing the only option. Check if the serdev device consumes an OF
> > node. If so: honor the new contract as per the DT bindings. If not: fall
> > back to the previous behavior by falling through to the existing
> > default label.
> >
> > Fixes: 9a15ce685706 ("Bluetooth: qca: use the power sequencer for QCA6390")
> > Reported-by: Wren Turkal <wt@penguintechs.org>
> > Closes: https://lore.kernel.org/linux-bluetooth/27e6a6c5-fb63-4219-be0b-eefa2c116e06@penguintechs.org/
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Was this commit supposed to have a Tested-by: footer for me?
>

Yes, I sent you an offlist message about it. You added:

+Tested-by: (...)

The leading `+` caused patchwork to omit the tag. Just do:

Tested-by: (...)

next time.

Thanks,
Bartosz

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-08-08  7:49 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31 15:20 [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions Bartosz Golaszewski
2024-07-31 15:20 ` [PATCH 1/3] Bluetooth: hci_qca: don't call pwrseq_power_off() twice for QCA6390 Bartosz Golaszewski
2024-07-31 15:20 ` [PATCH 2/3] Bluetooth: hci_qca: fix QCA6390 support on non-DT platforms Bartosz Golaszewski
2024-08-01  7:29   ` Paul Menzel
2024-08-01  7:39     ` Bartosz Golaszewski
2024-08-07 19:09   ` Wren Turkal
2024-08-08  7:49     ` Bartosz Golaszewski
2024-07-31 15:20 ` [PATCH 3/3] Bluetooth: hci_qca: fix a NULL-pointer derefence at shutdown Bartosz Golaszewski
2024-08-06 22:44   ` Nícolas F. R. A. Prado
2024-08-07  7:53     ` Bartosz Golaszewski
2024-08-07 15:03       ` Luiz Augusto von Dentz
2024-08-07 18:34         ` Nícolas F. R. A. Prado
2024-07-31 16:32 ` [PATCH 0/3] Bluetooth: hci_qca: fix post merge window regressions Luiz Augusto von Dentz
2024-08-01  3:57   ` Wren Turkal
2024-08-01  7:23     ` Wren Turkal
2024-08-01  8:20 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox