Remove thread unsafety usage and Add checking index of list
authorpr.jung <pr.jung@samsung.com>
Wed, 23 Mar 2016 10:43:10 +0000 (19:43 +0900)
committerpr.jung <pr.jung@samsung.com>
Thu, 24 Mar 2016 08:39:29 +0000 (17:39 +0900)
Change-Id: I7165afa2b4b540dda16e3d4a88f220708c081f71
Signed-off-by: pr.jung <pr.jung@samsung.com>
hw/display/display.c
hw/led/led.c

index 3d3f563..020eb33 100644 (file)
@@ -85,7 +85,7 @@ static int display_set_brightness(int brightness)
        v = brightness/100.f*max;
        r = sys_set_int(BACKLIGHT_PATH"/brightness", v);
        if (r < 0) {
-               _E("fail to set brightness : %s", strerror(r));
+               _E("fail to set brightness : %d", r);
                return r;
        }
 
index 56c7c02..4729f44 100644 (file)
@@ -100,6 +100,8 @@ static int led_open(struct hw_info *info,
                break;
        }
 
+       if (i >= list_len)
+               return -EINVAL;
        led_list[i].dev = calloc(1, sizeof(struct led_device));
        if (!led_list[i].dev)
                return -ENOMEM;