Re: [PATCH 1/1] Bluetooth: hci_bcm4377: Convert PCIBIOS_* return codes to errnos

From: Sven Peter
Date: Mon May 27 2024 - 12:13:54 EST


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