diff mbox series

[1/2] gpio: amd8111: Convert PCIBIOS_* return codes to errnos

Message ID 20240527132345.13956-1-ilpo.jarvinen@linux.intel.com
State New
Headers show
Series [1/2] gpio: amd8111: Convert PCIBIOS_* return codes to errnos | expand

Commit Message

Ilpo Järvinen May 27, 2024, 1:23 p.m. UTC
amd_gpio_init() uses pci_read_config_dword() that returns PCIBIOS_*
codes. The return code is then returned as is but amd_gpio_init() is
a module init function that should return normal errnos.

Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal
errno before returning it from amd_gpio_init().

Fixes: f942a7de047d ("gpio: add a driver for GPIO pins found on AMD-8111 south bridge chips")
Cc: stable@vger.kernel.org
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/gpio/gpio-amd8111.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Bartosz Golaszewski May 30, 2024, 9:21 a.m. UTC | #1
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Mon, 27 May 2024 16:23:44 +0300, Ilpo Järvinen wrote:
> amd_gpio_init() uses pci_read_config_dword() that returns PCIBIOS_*
> codes. The return code is then returned as is but amd_gpio_init() is
> a module init function that should return normal errnos.
> 
> Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal
> errno before returning it from amd_gpio_init().
> 
> [...]

Applied, thanks!

[1/2] gpio: amd8111: Convert PCIBIOS_* return codes to errnos
      commit: d4cde6e42f2eb56436cab6d1931738ec09e64f74
[2/2] gpio: rdc321x: Convert PCIBIOS_* return codes to errnos
      commit: 9a73e037f4b5eb45c9ecccb191d39c280abe7cbd

Best regards,
Bartosz Golaszewski May 30, 2024, 9:22 a.m. UTC | #2
On Mon, May 27, 2024 at 3:23 PM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
>
> amd_gpio_init() uses pci_read_config_dword() that returns PCIBIOS_*
> codes. The return code is then returned as is but amd_gpio_init() is
> a module init function that should return normal errnos.
>
> Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal
> errno before returning it from amd_gpio_init().
>
> Fixes: f942a7de047d ("gpio: add a driver for GPIO pins found on AMD-8111 south bridge chips")
> Cc: stable@vger.kernel.org

I dropped these.

Bart

> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>  drivers/gpio/gpio-amd8111.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-amd8111.c b/drivers/gpio/gpio-amd8111.c
> index 6f3ded619c8b..3377667a28de 100644
> --- a/drivers/gpio/gpio-amd8111.c
> +++ b/drivers/gpio/gpio-amd8111.c
> @@ -195,8 +195,10 @@ static int __init amd_gpio_init(void)
>
>  found:
>         err = pci_read_config_dword(pdev, 0x58, &gp.pmbase);
> -       if (err)
> +       if (err) {
> +               err = pcibios_err_to_errno(err);
>                 goto out;
> +       }
>         err = -EIO;
>         gp.pmbase &= 0x0000FF00;
>         if (gp.pmbase == 0)
> --
> 2.39.2
>
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-amd8111.c b/drivers/gpio/gpio-amd8111.c
index 6f3ded619c8b..3377667a28de 100644
--- a/drivers/gpio/gpio-amd8111.c
+++ b/drivers/gpio/gpio-amd8111.c
@@ -195,8 +195,10 @@  static int __init amd_gpio_init(void)
 
 found:
 	err = pci_read_config_dword(pdev, 0x58, &gp.pmbase);
-	if (err)
+	if (err) {
+		err = pcibios_err_to_errno(err);
 		goto out;
+	}
 	err = -EIO;
 	gp.pmbase &= 0x0000FF00;
 	if (gp.pmbase == 0)