diff mbox

drm/radeon: change function signature to pass full range

Message ID 20180412193333.4951-1-malat@debian.org (mailing list archive)
State New, archived
Headers show

Commit Message

Mathieu Malaterre April 12, 2018, 7:33 p.m. UTC
In function ‘radeon_process_i2c_ch’ a comparison of a u8 value against
255 is done. Since it is always false, change the signature of this
function to use an `int` instead, which match the type used in caller:
`radeon_atom_hw_i2c_xfer`.

Fix the following warning triggered with W=1:

  CC [M]  drivers/gpu/drm/radeon/atombios_i2c.o
  drivers/gpu/drm/radeon/atombios_i2c.c: In function ‘radeon_process_i2c_ch’:
  drivers/gpu/drm/radeon/atombios_i2c.c:71:11: warning: comparison is always false due to limited range of data type [-Wtype-limits]
   if (num > ATOM_MAX_HW_I2C_READ) {
           ^

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 drivers/gpu/drm/radeon/atombios_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Huang Rui April 13, 2018, 8:04 a.m. UTC | #1
On Thu, Apr 12, 2018 at 09:33:33PM +0200, Mathieu Malaterre wrote:
> In function ‘radeon_process_i2c_ch’ a comparison of a u8 value against
> 255 is done. Since it is always false, change the signature of this
> function to use an `int` instead, which match the type used in caller:
> `radeon_atom_hw_i2c_xfer`.
> 
> Fix the following warning triggered with W=1:
> 
>   CC [M]  drivers/gpu/drm/radeon/atombios_i2c.o
>   drivers/gpu/drm/radeon/atombios_i2c.c: In function ‘radeon_process_i2c_ch’:
>   drivers/gpu/drm/radeon/atombios_i2c.c:71:11: warning: comparison is always false due to limited range of data type [-Wtype-limits]
>    if (num > ATOM_MAX_HW_I2C_READ) {
>            ^
> 
> Signed-off-by: Mathieu Malaterre <malat@debian.org>

Reviewed-by: Huang Rui <ray.huang@amd.com>

> ---
>  drivers/gpu/drm/radeon/atombios_i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/radeon/atombios_i2c.c b/drivers/gpu/drm/radeon/atombios_i2c.c
> index 4157780585a0..9022e9af11a0 100644
> --- a/drivers/gpu/drm/radeon/atombios_i2c.c
> +++ b/drivers/gpu/drm/radeon/atombios_i2c.c
> @@ -35,7 +35,7 @@
>  
>  static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan,
>  				 u8 slave_addr, u8 flags,
> -				 u8 *buf, u8 num)
> +				 u8 *buf, int num)
>  {
>  	struct drm_device *dev = chan->dev;
>  	struct radeon_device *rdev = dev->dev_private;
> -- 
> 2.11.0
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Mathieu Malaterre Sept. 17, 2018, 10:19 a.m. UTC | #2
On Fri, Apr 13, 2018 at 9:59 AM Huang Rui <ray.huang@amd.com> wrote:

> On Thu, Apr 12, 2018 at 09:33:33PM +0200, Mathieu Malaterre wrote:
> > In function ‘radeon_process_i2c_ch’ a comparison of a u8 value against
> > 255 is done. Since it is always false, change the signature of this
> > function to use an `int` instead, which match the type used in caller:
> > `radeon_atom_hw_i2c_xfer`.
> >
> > Fix the following warning triggered with W=1:
> >
> >   CC [M]  drivers/gpu/drm/radeon/atombios_i2c.o
> >   drivers/gpu/drm/radeon/atombios_i2c.c: In function
> ‘radeon_process_i2c_ch’:
> >   drivers/gpu/drm/radeon/atombios_i2c.c:71:11: warning: comparison is
> always false due to limited range of data type [-Wtype-limits]
> >    if (num > ATOM_MAX_HW_I2C_READ) {
> >            ^
> >
> > Signed-off-by: Mathieu Malaterre <malat@debian.org>
>
> Reviewed-by: Huang Rui <ray.huang@amd.com>
>
>
Any chance to be included in the next pull request ? thanks


> > ---
> >  drivers/gpu/drm/radeon/atombios_i2c.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/radeon/atombios_i2c.c
> b/drivers/gpu/drm/radeon/atombios_i2c.c
> > index 4157780585a0..9022e9af11a0 100644
> > --- a/drivers/gpu/drm/radeon/atombios_i2c.c
> > +++ b/drivers/gpu/drm/radeon/atombios_i2c.c
> > @@ -35,7 +35,7 @@
> >
> >  static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan,
> >                                u8 slave_addr, u8 flags,
> > -                              u8 *buf, u8 num)
> > +                              u8 *buf, int num)
> >  {
> >       struct drm_device *dev = chan->dev;
> >       struct radeon_device *rdev = dev->dev_private;
> > --
> > 2.11.0
> >
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Fri, Apr 13, 2018 at 9:59 AM Huang Rui &lt;<a href="mailto:ray.huang@amd.com">ray.huang@amd.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Apr 12, 2018 at 09:33:33PM +0200, Mathieu Malaterre wrote:<br>
&gt; In function ‘radeon_process_i2c_ch’ a comparison of a u8 value against<br>
&gt; 255 is done. Since it is always false, change the signature of this<br>
&gt; function to use an `int` instead, which match the type used in caller:<br>
&gt; `radeon_atom_hw_i2c_xfer`.<br>
&gt; <br>
&gt; Fix the following warning triggered with W=1:<br>
&gt; <br>
&gt;   CC [M]  drivers/gpu/drm/radeon/atombios_i2c.o<br>
&gt;   drivers/gpu/drm/radeon/atombios_i2c.c: In function ‘radeon_process_i2c_ch’:<br>
&gt;   drivers/gpu/drm/radeon/atombios_i2c.c:71:11: warning: comparison is always false due to limited range of data type [-Wtype-limits]<br>
&gt;    if (num &gt; ATOM_MAX_HW_I2C_READ) {<br>
&gt;            ^<br>
&gt; <br>
&gt; Signed-off-by: Mathieu Malaterre &lt;<a href="mailto:malat@debian.org" target="_blank">malat@debian.org</a>&gt;<br>
<br>
Reviewed-by: Huang Rui &lt;<a href="mailto:ray.huang@amd.com" target="_blank">ray.huang@amd.com</a>&gt;<br>
<br></blockquote><div><br></div><div>Any chance to be included in the next pull request ? thanks</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
&gt; ---<br>
&gt;  drivers/gpu/drm/radeon/atombios_i2c.c | 2 +-<br>
&gt;  1 file changed, 1 insertion(+), 1 deletion(-)<br>
&gt; <br>
&gt; diff --git a/drivers/gpu/drm/radeon/atombios_i2c.c b/drivers/gpu/drm/radeon/atombios_i2c.c<br>
&gt; index 4157780585a0..9022e9af11a0 100644<br>
&gt; --- a/drivers/gpu/drm/radeon/atombios_i2c.c<br>
&gt; +++ b/drivers/gpu/drm/radeon/atombios_i2c.c<br>
&gt; @@ -35,7 +35,7 @@<br>
&gt;  <br>
&gt;  static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan,<br>
&gt;                                u8 slave_addr, u8 flags,<br>
&gt; -                              u8 *buf, u8 num)<br>
&gt; +                              u8 *buf, int num)<br>
&gt;  {<br>
&gt;       struct drm_device *dev = chan-&gt;dev;<br>
&gt;       struct radeon_device *rdev = dev-&gt;dev_private;<br>
&gt; -- <br>
&gt; 2.11.0<br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; amd-gfx mailing list<br>
&gt; <a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a><br>
&gt; <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</blockquote></div></div>
Alex Deucher Sept. 17, 2018, 9:45 p.m. UTC | #3
On Mon, Sep 17, 2018 at 4:29 PM Mathieu Malaterre <malat@debian.org> wrote:
>
>
>
> On Fri, Apr 13, 2018 at 9:59 AM Huang Rui <ray.huang@amd.com> wrote:
>>
>> On Thu, Apr 12, 2018 at 09:33:33PM +0200, Mathieu Malaterre wrote:
>> > In function ‘radeon_process_i2c_ch’ a comparison of a u8 value against
>> > 255 is done. Since it is always false, change the signature of this
>> > function to use an `int` instead, which match the type used in caller:
>> > `radeon_atom_hw_i2c_xfer`.
>> >
>> > Fix the following warning triggered with W=1:
>> >
>> >   CC [M]  drivers/gpu/drm/radeon/atombios_i2c.o
>> >   drivers/gpu/drm/radeon/atombios_i2c.c: In function ‘radeon_process_i2c_ch’:
>> >   drivers/gpu/drm/radeon/atombios_i2c.c:71:11: warning: comparison is always false due to limited range of data type [-Wtype-limits]
>> >    if (num > ATOM_MAX_HW_I2C_READ) {
>> >            ^
>> >
>> > Signed-off-by: Mathieu Malaterre <malat@debian.org>
>>
>> Reviewed-by: Huang Rui <ray.huang@amd.com>
>>
>
> Any chance to be included in the next pull request ? thanks

Applied.  thanks for the reminder.

Alex

>
>>
>> > ---
>> >  drivers/gpu/drm/radeon/atombios_i2c.c | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/gpu/drm/radeon/atombios_i2c.c b/drivers/gpu/drm/radeon/atombios_i2c.c
>> > index 4157780585a0..9022e9af11a0 100644
>> > --- a/drivers/gpu/drm/radeon/atombios_i2c.c
>> > +++ b/drivers/gpu/drm/radeon/atombios_i2c.c
>> > @@ -35,7 +35,7 @@
>> >
>> >  static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan,
>> >                                u8 slave_addr, u8 flags,
>> > -                              u8 *buf, u8 num)
>> > +                              u8 *buf, int num)
>> >  {
>> >       struct drm_device *dev = chan->dev;
>> >       struct radeon_device *rdev = dev->dev_private;
>> > --
>> > 2.11.0
>> >
>> > _______________________________________________
>> > amd-gfx mailing list
>> > amd-gfx@lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/atombios_i2c.c b/drivers/gpu/drm/radeon/atombios_i2c.c
index 4157780585a0..9022e9af11a0 100644
--- a/drivers/gpu/drm/radeon/atombios_i2c.c
+++ b/drivers/gpu/drm/radeon/atombios_i2c.c
@@ -35,7 +35,7 @@ 
 
 static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan,
 				 u8 slave_addr, u8 flags,
-				 u8 *buf, u8 num)
+				 u8 *buf, int num)
 {
 	struct drm_device *dev = chan->dev;
 	struct radeon_device *rdev = dev->dev_private;