All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Bluetooth: hci_bcm4377: Convert PCIBIOS_* return codes to errnos
@ 2024-05-27 13:25 ` Ilpo Järvinen
  0 siblings, 0 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2024-05-27 13:25 UTC (permalink / raw)
  To: Hector Martin, Sven Peter, Alyssa Rosenzweig, Marcel Holtmann,
	Luiz Augusto von Dentz, asahi, linux-arm-kernel, linux-bluetooth,
	linux-kernel
  Cc: Ilpo Järvinen, stable

bcm4377_init_cfg() uses pci_{read,write}_config_dword() that return
PCIBIOS_* codes. The return codes are returned into the calling
bcm4377_probe() which directly returns the error which is of incorrect
type (a probe should return normal errnos).

Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal
errno before returning it from bcm4377_init_cfg. This conversion is the
easiest by adding a label next to return and doing the conversion there
once rather than adding pcibios_err_to_errno() into every single return
statement.

Fixes: 8a06127602de ("Bluetooth: hci_bcm4377: Add new driver for BCM4377 PCIe boards")
Cc: stable@vger.kernel.org
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/bluetooth/hci_bcm4377.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/bluetooth/hci_bcm4377.c b/drivers/bluetooth/hci_bcm4377.c
index 0c2f15235b4c..b00240109dc3 100644
--- a/drivers/bluetooth/hci_bcm4377.c
+++ b/drivers/bluetooth/hci_bcm4377.c
@@ -2134,44 +2134,46 @@ static int bcm4377_init_cfg(struct bcm4377_data *bcm4377)
 				     BCM4377_PCIECFG_BAR0_WINDOW1,
 				     bcm4377->hw->bar0_window1);
 	if (ret)
-		return ret;
+		goto fail;
 
 	ret = pci_write_config_dword(bcm4377->pdev,
 				     BCM4377_PCIECFG_BAR0_WINDOW2,
 				     bcm4377->hw->bar0_window2);
 	if (ret)
-		return ret;
+		goto fail;
 
 	ret = pci_write_config_dword(
 		bcm4377->pdev, BCM4377_PCIECFG_BAR0_CORE2_WINDOW1,
 		BCM4377_PCIECFG_BAR0_CORE2_WINDOW1_DEFAULT);
 	if (ret)
-		return ret;
+		goto fail;
 
 	if (bcm4377->hw->has_bar0_core2_window2) {
 		ret = pci_write_config_dword(bcm4377->pdev,
 					     BCM4377_PCIECFG_BAR0_CORE2_WINDOW2,
 					     bcm4377->hw->bar0_core2_window2);
 		if (ret)
-			return ret;
+			goto fail;
 	}
 
 	ret = pci_write_config_dword(bcm4377->pdev, BCM4377_PCIECFG_BAR2_WINDOW,
 				     BCM4377_PCIECFG_BAR2_WINDOW_DEFAULT);
 	if (ret)
-		return ret;
+		goto fail;
 
 	ret = pci_read_config_dword(bcm4377->pdev,
 				    BCM4377_PCIECFG_SUBSYSTEM_CTRL, &ctrl);
 	if (ret)
-		return ret;
+		goto fail;
 
 	if (bcm4377->hw->clear_pciecfg_subsystem_ctrl_bit19)
 		ctrl &= ~BIT(19);
 	ctrl |= BIT(16);
 
-	return pci_write_config_dword(bcm4377->pdev,
-				      BCM4377_PCIECFG_SUBSYSTEM_CTRL, ctrl);
+	ret = pci_write_config_dword(bcm4377->pdev,
+				     BCM4377_PCIECFG_SUBSYSTEM_CTRL, ctrl);
+fail:
+	return pcibios_err_to_errno(ret);
 }
 
 static int bcm4377_probe_dmi(struct bcm4377_data *bcm4377)
-- 
2.39.2


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

* [PATCH 1/1] Bluetooth: hci_bcm4377: Convert PCIBIOS_* return codes to errnos
@ 2024-05-27 13:25 ` Ilpo Järvinen
  0 siblings, 0 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2024-05-27 13:25 UTC (permalink / raw)
  To: Hector Martin, Sven Peter, Alyssa Rosenzweig, Marcel Holtmann,
	Luiz Augusto von Dentz, asahi, linux-arm-kernel, linux-bluetooth,
	linux-kernel
  Cc: Ilpo Järvinen, stable

bcm4377_init_cfg() uses pci_{read,write}_config_dword() that return
PCIBIOS_* codes. The return codes are returned into the calling
bcm4377_probe() which directly returns the error which is of incorrect
type (a probe should return normal errnos).

Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal
errno before returning it from bcm4377_init_cfg. This conversion is the
easiest by adding a label next to return and doing the conversion there
once rather than adding pcibios_err_to_errno() into every single return
statement.

Fixes: 8a06127602de ("Bluetooth: hci_bcm4377: Add new driver for BCM4377 PCIe boards")
Cc: stable@vger.kernel.org
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/bluetooth/hci_bcm4377.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/bluetooth/hci_bcm4377.c b/drivers/bluetooth/hci_bcm4377.c
index 0c2f15235b4c..b00240109dc3 100644
--- a/drivers/bluetooth/hci_bcm4377.c
+++ b/drivers/bluetooth/hci_bcm4377.c
@@ -2134,44 +2134,46 @@ static int bcm4377_init_cfg(struct bcm4377_data *bcm4377)
 				     BCM4377_PCIECFG_BAR0_WINDOW1,
 				     bcm4377->hw->bar0_window1);
 	if (ret)
-		return ret;
+		goto fail;
 
 	ret = pci_write_config_dword(bcm4377->pdev,
 				     BCM4377_PCIECFG_BAR0_WINDOW2,
 				     bcm4377->hw->bar0_window2);
 	if (ret)
-		return ret;
+		goto fail;
 
 	ret = pci_write_config_dword(
 		bcm4377->pdev, BCM4377_PCIECFG_BAR0_CORE2_WINDOW1,
 		BCM4377_PCIECFG_BAR0_CORE2_WINDOW1_DEFAULT);
 	if (ret)
-		return ret;
+		goto fail;
 
 	if (bcm4377->hw->has_bar0_core2_window2) {
 		ret = pci_write_config_dword(bcm4377->pdev,
 					     BCM4377_PCIECFG_BAR0_CORE2_WINDOW2,
 					     bcm4377->hw->bar0_core2_window2);
 		if (ret)
-			return ret;
+			goto fail;
 	}
 
 	ret = pci_write_config_dword(bcm4377->pdev, BCM4377_PCIECFG_BAR2_WINDOW,
 				     BCM4377_PCIECFG_BAR2_WINDOW_DEFAULT);
 	if (ret)
-		return ret;
+		goto fail;
 
 	ret = pci_read_config_dword(bcm4377->pdev,
 				    BCM4377_PCIECFG_SUBSYSTEM_CTRL, &ctrl);
 	if (ret)
-		return ret;
+		goto fail;
 
 	if (bcm4377->hw->clear_pciecfg_subsystem_ctrl_bit19)
 		ctrl &= ~BIT(19);
 	ctrl |= BIT(16);
 
-	return pci_write_config_dword(bcm4377->pdev,
-				      BCM4377_PCIECFG_SUBSYSTEM_CTRL, ctrl);
+	ret = pci_write_config_dword(bcm4377->pdev,
+				     BCM4377_PCIECFG_SUBSYSTEM_CTRL, ctrl);
+fail:
+	return pcibios_err_to_errno(ret);
 }
 
 static int bcm4377_probe_dmi(struct bcm4377_data *bcm4377)
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* RE: [1/1] Bluetooth: hci_bcm4377: Convert PCIBIOS_* return codes to errnos
  2024-05-27 13:25 ` Ilpo Järvinen
  (?)
@ 2024-05-27 13:56 ` bluez.test.bot
  -1 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2024-05-27 13:56 UTC (permalink / raw)
  To: linux-bluetooth, ilpo.jarvinen

[-- Attachment #1: Type: text/plain, Size: 2843 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=856174

---Test result---

Test Summary:
CheckPatch                    PASS      0.52 seconds
GitLint                       PASS      0.22 seconds
SubjectPrefix                 PASS      0.07 seconds
BuildKernel                   PASS      30.98 seconds
CheckAllWarning               PASS      33.58 seconds
CheckSparse                   PASS      38.99 seconds
CheckSmatch                   FAIL      36.25 seconds
BuildKernel32                 PASS      30.08 seconds
TestRunnerSetup               PASS      538.33 seconds
TestRunner_l2cap-tester       PASS      18.73 seconds
TestRunner_iso-tester         FAIL      35.79 seconds
TestRunner_bnep-tester        PASS      4.90 seconds
TestRunner_mgmt-tester        PASS      111.85 seconds
TestRunner_rfcomm-tester      PASS      7.63 seconds
TestRunner_sco-tester         PASS      15.16 seconds
TestRunner_ioctl-tester       PASS      8.03 seconds
TestRunner_mesh-tester        FAIL      6.27 seconds
TestRunner_smp-tester         PASS      7.08 seconds
TestRunner_userchan-tester    PASS      5.16 seconds
IncrementalBuild              PASS      28.91 seconds

Details
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139
make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 122, Passed: 117 (95.9%), Failed: 1, Not Run: 4

Failed Test Cases
ISO Connect Suspend - Success                        Failed       4.172 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 9 (90.0%), Failed: 1, Not Run: 0

Failed Test Cases
Mesh - Send cancel - 1                               Failed       0.110 seconds


---
Regards,
Linux Bluetooth


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

* Re: [PATCH 1/1] Bluetooth: hci_bcm4377: Convert PCIBIOS_* return codes to errnos
  2024-05-27 13:25 ` Ilpo Järvinen
@ 2024-05-27 16:00   ` Sven Peter
  -1 siblings, 0 replies; 5+ messages in thread
From: Sven Peter @ 2024-05-27 16:00 UTC (permalink / raw)
  To: Ilpo Järvinen, Hector Martin, Alyssa Rosenzweig,
	Marcel Holtmann, Luiz Augusto von Dentz, asahi, linux-arm-kernel,
	linux-bluetooth, linux-kernel
  Cc: stable

Hi,


On Mon, May 27, 2024, at 15:25, Ilpo Järvinen wrote:
> bcm4377_init_cfg() uses pci_{read,write}_config_dword() that return
> PCIBIOS_* codes. The return codes are returned into the calling
> bcm4377_probe() which directly returns the error which is of incorrect
> type (a probe should return normal errnos).

Good catch!

>
> Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal
> errno before returning it from bcm4377_init_cfg. This conversion is the
> easiest by adding a label next to return and doing the conversion there
> once rather than adding pcibios_err_to_errno() into every single return
> statement.

Given that bcm4377_init_cfg is only called at one place from bcm4377_probe
we could also just do something like

	ret = bcm4377_init_cfg(bcm4377);
	if (ret)
		return pcibios_err_to_errno(ret);

there, but either way is fine with me.


Best,


Sven


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

* Re: [PATCH 1/1] Bluetooth: hci_bcm4377: Convert PCIBIOS_* return codes to errnos
@ 2024-05-27 16:00   ` Sven Peter
  0 siblings, 0 replies; 5+ messages in thread
From: Sven Peter @ 2024-05-27 16:00 UTC (permalink / raw)
  To: Ilpo Järvinen, Hector Martin, Alyssa Rosenzweig,
	Marcel Holtmann, Luiz Augusto von Dentz, asahi, linux-arm-kernel,
	linux-bluetooth, linux-kernel
  Cc: stable

Hi,


On Mon, May 27, 2024, at 15:25, Ilpo Järvinen wrote:
> bcm4377_init_cfg() uses pci_{read,write}_config_dword() that return
> PCIBIOS_* codes. The return codes are returned into the calling
> bcm4377_probe() which directly returns the error which is of incorrect
> type (a probe should return normal errnos).

Good catch!

>
> Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal
> errno before returning it from bcm4377_init_cfg. This conversion is the
> easiest by adding a label next to return and doing the conversion there
> once rather than adding pcibios_err_to_errno() into every single return
> statement.

Given that bcm4377_init_cfg is only called at one place from bcm4377_probe
we could also just do something like

	ret = bcm4377_init_cfg(bcm4377);
	if (ret)
		return pcibios_err_to_errno(ret);

there, but either way is fine with me.


Best,


Sven


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2024-05-27 16:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27 13:25 [PATCH 1/1] Bluetooth: hci_bcm4377: Convert PCIBIOS_* return codes to errnos Ilpo Järvinen
2024-05-27 13:25 ` Ilpo Järvinen
2024-05-27 13:56 ` [1/1] " bluez.test.bot
2024-05-27 16:00 ` [PATCH 1/1] " Sven Peter
2024-05-27 16:00   ` Sven Peter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.