drm/rockchip: fix error check when getting irq
authorHeiko Stuebner <heiko@sntech.de>
Sun, 19 Apr 2015 23:00:53 +0000 (01:00 +0200)
committerMark Yao <mark.yao@rock-chips.com>
Mon, 20 Apr 2015 01:02:31 +0000 (09:02 +0800)
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>
drivers/gpu/drm/rockchip/rockchip_drm_vop.c

index ccb0ce073ef2af6f2233fbc88428ea176dbea855..4557f335a8a56f243ad4aa326a1826572116d3a5 100644 (file)
@@ -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);