All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Mark Yao <mark.yao@rock-chips.com>
Cc: linux-rockchip@lists.infradead.org,
	David Binderman <dcb314@hotmail.com>,
	dri-devel@lists.freedesktop.org
Subject: [PATCH v2 2/2] drm/rockchip: fix error check when getting irq
Date: Mon, 20 Apr 2015 01:00:53 +0200	[thread overview]
Message-ID: <3764323.LdZbgzYxeM@diego> (raw)
In-Reply-To: <12997834.ylvFCp2ANf@diego>

platform_get_irq() can return negative error values and we already test for
these. Therefore the variable holding this value should be signed to not
loose possible error values.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-By: Daniel Kurtz <djkurtz@chromium.org>
---
changed since v1:
- instead of making irq in struct vop signed use a
  separate local irq int in vop_bind as suggested by Daniel Kurtz

 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index ccb0ce0..0e539d8 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1409,7 +1409,7 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
 	struct vop *vop;
 	struct resource *res;
 	size_t alloc_size;
-	int ret;
+	int ret, irq;
 
 	of_id = of_match_device(vop_driver_dt_match, dev);
 	vop_data = of_id->data;
@@ -1445,11 +1445,12 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
 		return ret;
 	}
 
-	vop->irq = platform_get_irq(pdev, 0);
-	if (vop->irq < 0) {
+ 	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
 		dev_err(dev, "cannot find irq for vop\n");
-		return vop->irq;
+		return irq;
 	}
+	vop->irq = (unsigned int)irq;
 
 	spin_lock_init(&vop->reg_lock);
 	spin_lock_init(&vop->irq_lock);
-- 
2.1.4


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

  reply	other threads:[~2015-04-19 23:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-19 22:59 [PATCH v2 1/2] MAINTAINERS: add entry for Rockchip drm drivers Heiko Stübner
2015-04-19 23:00 ` Heiko Stübner [this message]
2015-04-20  1:33   ` [PATCH v2 2/2] drm/rockchip: fix error check when getting irq Mark yao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3764323.LdZbgzYxeM@diego \
    --to=heiko@sntech.de \
    --cc=dcb314@hotmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.yao@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.