diff mbox series

[4/4] drm/bridge: ti-sn65dsi86: Check the regmap return value when setting a GPIO

Message ID 20200608104832.4.Ia4376fd88cdc6e8f8b43c65548458305f82f1d61@changeid (mailing list archive)
State New, archived
Headers show
Series [1/4] drm/bridge: ti-sn65dsi86: Don't compile GPIO bits if not CONFIG_OF_GPIO | expand

Commit Message

Doug Anderson June 8, 2020, 5:48 p.m. UTC
The ti_sn_bridge_gpio_set() got the return value of
regmap_update_bits() but didn't check it.  The function can't return
an error value, but we should at least print a warning if it didn't
work.

This fixes a compiler warning about setting "ret" but not using it.

Fixes: 27ed2b3f22ed ("drm/bridge: ti-sn65dsi86: Export bridge GPIOs to Linux")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Stephen Boyd June 11, 2020, 9:58 a.m. UTC | #1
Quoting Douglas Anderson (2020-06-08 10:48:35)
> The ti_sn_bridge_gpio_set() got the return value of
> regmap_update_bits() but didn't check it.  The function can't return
> an error value, but we should at least print a warning if it didn't
> work.
> 
> This fixes a compiler warning about setting "ret" but not using it.
> 
> Fixes: 27ed2b3f22ed ("drm/bridge: ti-sn65dsi86: Export bridge GPIOs to Linux")
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> 
>  drivers/gpu/drm/bridge/ti-sn65dsi86.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> index 1080e4f9df96..526add27dc03 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> @@ -999,6 +999,9 @@ static void ti_sn_bridge_gpio_set(struct gpio_chip *chip, unsigned int offset,
>         ret = regmap_update_bits(pdata->regmap, SN_GPIO_IO_REG,
>                                  BIT(SN_GPIO_OUTPUT_SHIFT + offset),
>                                  val << (SN_GPIO_OUTPUT_SHIFT + offset));
> +       if (ret)
> +               dev_warn(pdata->dev,
> +                        "Failed to set bridge GPIO %d: %d\n", offset, ret);

GPIO %u because it's unsigned?
Doug Anderson June 11, 2020, 2:34 p.m. UTC | #2
Hi,

On Thu, Jun 11, 2020 at 2:58 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Douglas Anderson (2020-06-08 10:48:35)
> > The ti_sn_bridge_gpio_set() got the return value of
> > regmap_update_bits() but didn't check it.  The function can't return
> > an error value, but we should at least print a warning if it didn't
> > work.
> >
> > This fixes a compiler warning about setting "ret" but not using it.
> >
> > Fixes: 27ed2b3f22ed ("drm/bridge: ti-sn65dsi86: Export bridge GPIOs to Linux")
> > Signed-off-by: Douglas Anderson <dianders@chromium.org>
> > ---
> >
> >  drivers/gpu/drm/bridge/ti-sn65dsi86.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> > index 1080e4f9df96..526add27dc03 100644
> > --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> > +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> > @@ -999,6 +999,9 @@ static void ti_sn_bridge_gpio_set(struct gpio_chip *chip, unsigned int offset,
> >         ret = regmap_update_bits(pdata->regmap, SN_GPIO_IO_REG,
> >                                  BIT(SN_GPIO_OUTPUT_SHIFT + offset),
> >                                  val << (SN_GPIO_OUTPUT_SHIFT + offset));
> > +       if (ret)
> > +               dev_warn(pdata->dev,
> > +                        "Failed to set bridge GPIO %d: %d\n", offset, ret);
>
> GPIO %u because it's unsigned?

Sure.  I'll plan to spin tomorrow in case anyone else has any
feedback.  If any maintainer would prefer me not to spin and would
rather fix this when applying, please shout and I won't send out a v2.

-Doug
Neil Armstrong June 29, 2020, 8:41 a.m. UTC | #3
On 11/06/2020 16:34, Doug Anderson wrote:
> Hi,
> 
> On Thu, Jun 11, 2020 at 2:58 AM Stephen Boyd <swboyd@chromium.org> wrote:
>>
>> Quoting Douglas Anderson (2020-06-08 10:48:35)
>>> The ti_sn_bridge_gpio_set() got the return value of
>>> regmap_update_bits() but didn't check it.  The function can't return
>>> an error value, but we should at least print a warning if it didn't
>>> work.
>>>
>>> This fixes a compiler warning about setting "ret" but not using it.
>>>
>>> Fixes: 27ed2b3f22ed ("drm/bridge: ti-sn65dsi86: Export bridge GPIOs to Linux")
>>> Signed-off-by: Douglas Anderson <dianders@chromium.org>
>>> ---
>>>
>>>  drivers/gpu/drm/bridge/ti-sn65dsi86.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
>>> index 1080e4f9df96..526add27dc03 100644
>>> --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
>>> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
>>> @@ -999,6 +999,9 @@ static void ti_sn_bridge_gpio_set(struct gpio_chip *chip, unsigned int offset,
>>>         ret = regmap_update_bits(pdata->regmap, SN_GPIO_IO_REG,
>>>                                  BIT(SN_GPIO_OUTPUT_SHIFT + offset),
>>>                                  val << (SN_GPIO_OUTPUT_SHIFT + offset));
>>> +       if (ret)
>>> +               dev_warn(pdata->dev,
>>> +                        "Failed to set bridge GPIO %d: %d\n", offset, ret);
>>
>> GPIO %u because it's unsigned?
> 
> Sure.  I'll plan to spin tomorrow in case anyone else has any
> feedback.  If any maintainer would prefer me not to spin and would
> rather fix this when applying, please shout and I won't send out a v2.
> 
> -Doug
> 

Yes please respin, ping me on IRC if I forget to apply..

Neil
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
index 1080e4f9df96..526add27dc03 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
@@ -999,6 +999,9 @@  static void ti_sn_bridge_gpio_set(struct gpio_chip *chip, unsigned int offset,
 	ret = regmap_update_bits(pdata->regmap, SN_GPIO_IO_REG,
 				 BIT(SN_GPIO_OUTPUT_SHIFT + offset),
 				 val << (SN_GPIO_OUTPUT_SHIFT + offset));
+	if (ret)
+		dev_warn(pdata->dev,
+			 "Failed to set bridge GPIO %d: %d\n", offset, ret);
 }
 
 static int ti_sn_bridge_gpio_direction_input(struct gpio_chip *chip,