dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] drm/radeon: fix unsigned comparison with 0
@ 2020-05-05  4:57 ChenTao
  2020-05-05 14:50 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: ChenTao @ 2020-05-05  4:57 UTC (permalink / raw)
  To: airlied, daniel
  Cc: linux-kernel, dri-devel, chentao107, amd-gfx, alexander.deucher,
	christian.koenig

Fixes warning because pipe is unsigned long and can never be negtative

vers/gpu/drm/radeon/radeon_kms.c:831:11: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if (pipe < 0 || pipe >= rdev->num_crtc) {
drivers/gpu/drm/radeon/radeon_kms.c:857:11: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if (pipe < 0 || pipe >= rdev->num_crtc) {

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: ChenTao <chentao107@huawei.com>
---
 drivers/gpu/drm/radeon/radeon_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 372962358a18..c5d1dc9618a4 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -828,7 +828,7 @@ int radeon_enable_vblank_kms(struct drm_crtc *crtc)
 	unsigned long irqflags;
 	int r;
 
-	if (pipe < 0 || pipe >= rdev->num_crtc) {
+	if (pipe >= rdev->num_crtc) {
 		DRM_ERROR("Invalid crtc %d\n", pipe);
 		return -EINVAL;
 	}
@@ -854,7 +854,7 @@ void radeon_disable_vblank_kms(struct drm_crtc *crtc)
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
 
-	if (pipe < 0 || pipe >= rdev->num_crtc) {
+	if (pipe >= rdev->num_crtc) {
 		DRM_ERROR("Invalid crtc %d\n", pipe);
 		return;
 	}
-- 
2.22.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] drm/radeon: fix unsigned comparison with 0
  2020-05-05  4:57 [PATCH -next] drm/radeon: fix unsigned comparison with 0 ChenTao
@ 2020-05-05 14:50 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2020-05-05 14:50 UTC (permalink / raw)
  To: ChenTao
  Cc: Dave Airlie, LKML, Maling list - DRI developers, amd-gfx list,
	Deucher, Alexander, Christian Koenig

On Tue, May 5, 2020 at 2:59 AM ChenTao <chentao107@huawei.com> wrote:
>
> Fixes warning because pipe is unsigned long and can never be negtative
>
> vers/gpu/drm/radeon/radeon_kms.c:831:11: warning:
> comparison of unsigned expression < 0 is always false [-Wtype-limits]
>   if (pipe < 0 || pipe >= rdev->num_crtc) {
> drivers/gpu/drm/radeon/radeon_kms.c:857:11: warning:
> comparison of unsigned expression < 0 is always false [-Wtype-limits]
>   if (pipe < 0 || pipe >= rdev->num_crtc) {
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: ChenTao <chentao107@huawei.com>

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_kms.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
> index 372962358a18..c5d1dc9618a4 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -828,7 +828,7 @@ int radeon_enable_vblank_kms(struct drm_crtc *crtc)
>         unsigned long irqflags;
>         int r;
>
> -       if (pipe < 0 || pipe >= rdev->num_crtc) {
> +       if (pipe >= rdev->num_crtc) {
>                 DRM_ERROR("Invalid crtc %d\n", pipe);
>                 return -EINVAL;
>         }
> @@ -854,7 +854,7 @@ void radeon_disable_vblank_kms(struct drm_crtc *crtc)
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
>
> -       if (pipe < 0 || pipe >= rdev->num_crtc) {
> +       if (pipe >= rdev->num_crtc) {
>                 DRM_ERROR("Invalid crtc %d\n", pipe);
>                 return;
>         }
> --
> 2.22.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-05 14:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05  4:57 [PATCH -next] drm/radeon: fix unsigned comparison with 0 ChenTao
2020-05-05 14:50 ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).