Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1420958 > unrolled thread

linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?

Started byDavid Binderman <linuxdev.baldrick@gmail.com>
First post2016-06-13 17:00 +0200
Last post2016-06-15 12:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless  tests ? David Binderman <linuxdev.baldrick@gmail.com> - 2016-06-13 17:00 +0200
    Re: linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 *  pointless tests ? Rob Clark <robdclark@gmail.com> - 2016-06-13 17:30 +0200
      Re: linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 *  pointless tests ? David Binderman <linuxdev.baldrick@gmail.com> - 2016-06-15 12:10 +0200

#1420958 — linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?

FromDavid Binderman <linuxdev.baldrick@gmail.com>
Date2016-06-13 17:00 +0200
Subjectlinux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?
Message-ID<rJBvj-7FA-3@gated-at.bofh.it>
Hello there,

1.

linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:545]: (style)
Checking if unsigned variable 'pipe' is less than zero.

Source code is

    if (pipe < 0 || pipe >= priv->num_crtcs) {

2.

linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:567]: (style)
Checking if unsigned variable 'pipe' is less than zero.

Duplicate a few lines further down.


Regards

David Binderman

[toc] | [next] | [standalone]


#1420996 — Re: linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?

FromRob Clark <robdclark@gmail.com>
Date2016-06-13 17:30 +0200
SubjectRe: linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?
Message-ID<rJBYn-86X-39@gated-at.bofh.it>
In reply to#1420958
yup, looks like we can drop the two pipe<0 checks.  Care to send a patch?

BR,
-R

On Mon, Jun 13, 2016 at 10:51 AM, David Binderman
<linuxdev.baldrick@gmail.com> wrote:
> Hello there,
>
> 1.
>
> linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:545]: (style)
> Checking if unsigned variable 'pipe' is less than zero.
>
> Source code is
>
>     if (pipe < 0 || pipe >= priv->num_crtcs) {
>
> 2.
>
> linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:567]: (style)
> Checking if unsigned variable 'pipe' is less than zero.
>
> Duplicate a few lines further down.
>
>
> Regards
>
> David Binderman

[toc] | [prev] | [next] | [standalone]


#1422852 — Re: linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?

FromDavid Binderman <linuxdev.baldrick@gmail.com>
Date2016-06-15 12:10 +0200
SubjectRe: linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?
Message-ID<rKfVL-1co-1@gated-at.bofh.it>
In reply to#1420996
Hello there,

>yup, looks like we can drop the two pipe<0 checks.

Righto.

>Care to send a patch?

Oh dear. My success rate with patches is near zero. Maybe something
like this might be suitable:

*** linux-3.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c.sav
2016-06-15 10:58:04.868619030 +0100
--- linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c   2016-06-15
10:58:25.401942157 +0100
***************
*** 542,548 ****
    struct msm_drm_private *priv = dev->dev_private;
    struct drm_crtc *crtc;

!   if (pipe < 0 || pipe >= priv->num_crtcs) {
        DRM_ERROR("Invalid crtc %d\n", pipe);
        return -EINVAL;
    }
--- 542,548 ----
    struct msm_drm_private *priv = dev->dev_private;
    struct drm_crtc *crtc;

!   if (pipe >= priv->num_crtcs) {
        DRM_ERROR("Invalid crtc %d\n", pipe);
        return -EINVAL;
    }
***************
*** 564,570 ****
    struct drm_crtc *crtc;
    struct drm_encoder *encoder;

!   if (pipe < 0 || pipe >= priv->num_crtcs)
        return 0;

    crtc = priv->crtcs[pipe];
--- 564,570 ----
    struct drm_crtc *crtc;
    struct drm_encoder *encoder;

!   if (pipe >= priv->num_crtcs)
        return 0;

    crtc = priv->crtcs[pipe];

Feel free to mess this tentative patch about in any way you see fit.


Regards

David Binderman


On Mon, Jun 13, 2016 at 4:27 PM, Rob Clark <robdclark@gmail.com> wrote:
> yup, looks like we can drop the two pipe<0 checks.  Care to send a patch?
>
> BR,
> -R
>
> On Mon, Jun 13, 2016 at 10:51 AM, David Binderman
> <linuxdev.baldrick@gmail.com> wrote:
>> Hello there,
>>
>> 1.
>>
>> linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:545]: (style)
>> Checking if unsigned variable 'pipe' is less than zero.
>>
>> Source code is
>>
>>     if (pipe < 0 || pipe >= priv->num_crtcs) {
>>
>> 2.
>>
>> linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:567]: (style)
>> Checking if unsigned variable 'pipe' is less than zero.
>>
>> Duplicate a few lines further down.
>>
>>
>> Regards
>>
>> David Binderman

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web