Checking return value 51/257451/2 accepted/tizen_6.5_unified tizen_bkup_20220207 accepted/tizen/6.5/unified/20211029.013629 accepted/tizen/unified/20210510.155204 submit/tizen/20210427.040101 submit/tizen/20210510.014617 submit/tizen/20210609.044139 submit/tizen_6.5/20211028.163501 tizen_6.5.m2_release
authordyamy-lee <dyamy.lee@samsung.com>
Mon, 26 Apr 2021 06:13:30 +0000 (15:13 +0900)
committerdyamy-lee <dyamy.lee@samsung.com>
Mon, 26 Apr 2021 08:41:51 +0000 (17:41 +0900)
When using return value from other function, it is usually checked for it.

Change-Id: I071942d9885500ce37adf08f89788d59d031d458

haltests/test_hal_libinput_info.cpp

index b39f3dc624b8bb6da4ee608e393a8ffb9fd082c6..5ddbe48b433b25e540acfcaf2642dcccd3885287 100644 (file)
@@ -29,6 +29,7 @@ int handle_device_notify(struct libinput_event *ev)
        struct udev_device *udev_device = libinput_device_get_udev_device(dev);
        enum libinput_event_type type;
        const char *devnode;
+       const char *test = NULL;
        errno = 0;
 
        switch(libinput_event_get_type(ev)) {
@@ -42,7 +43,8 @@ int handle_device_notify(struct libinput_event *ev)
                abort();
        }
 
-       if(strstr(udev_device_get_property_value(udev_device, "DEVPATH"), "virtual")){
+       test = udev_device_get_property_value(udev_device, "DEVPATH");
+       if(test && strstr(test, "virtual")){
                LOG("It's contain virtual. No Check.\n");
                return 0;
        }
@@ -50,7 +52,6 @@ int handle_device_notify(struct libinput_event *ev)
        if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_KEYBOARD)) {
                devnode = udev_device_get_devnode(libinput_device_get_udev_device(dev));
                if(type == LIBINPUT_EVENT_DEVICE_ADDED) { // TODO. save using linked list
-                       const char *test = NULL;
                        test = udev_device_get_property_value(udev_device, "ID_INPUT_KEYBOARD");
                        LOG("devnode = %s\n", devnode);
                        if(test && (test[0] == '1')){