Re: [PATCH] gpio: pca953x: Print the error code on read/write failures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 21, 2024 at 1:42 PM Fabio Estevam <festevam@xxxxxxxxx> wrote:
>
> From: Fabio Estevam <festevam@xxxxxxx>
>
> Print the error code in the pca953x_write_regs() and pca953x_read_regs()
> functions to help debugging.
>
> Suggested-by: Russell King (Oracle) <linux@xxxxxxxxxxxxxxx>
> Signed-off-by: Fabio Estevam <festevam@xxxxxxx>
> ---
>  drivers/gpio/gpio-pca953x.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index 8baf3edd5274..3f2d33ee20cc 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -498,7 +498,7 @@ static int pca953x_write_regs(struct pca953x_chip *chip, int reg, unsigned long
>
>         ret = regmap_bulk_write(chip->regmap, regaddr, value, NBANK(chip));
>         if (ret < 0) {
> -               dev_err(&chip->client->dev, "failed writing register\n");
> +               dev_err(&chip->client->dev, "failed writing register: %d\n", ret);
>                 return ret;
>         }
>
> @@ -513,7 +513,7 @@ static int pca953x_read_regs(struct pca953x_chip *chip, int reg, unsigned long *
>
>         ret = regmap_bulk_read(chip->regmap, regaddr, value, NBANK(chip));
>         if (ret < 0) {
> -               dev_err(&chip->client->dev, "failed reading register\n");
> +               dev_err(&chip->client->dev, "failed reading register: %d\n", ret);
>                 return ret;
>         }
>
> --
> 2.34.1
>

How about using dev_err_probe() instead?

Bart





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux