selftests: media_dcevice_test fix to handle ioctl failure case
authorShuah Khan <shuahkh@osg.samsung.com>
Thu, 25 Feb 2016 17:17:42 +0000 (10:17 -0700)
committerShuah Khan <shuahkh@osg.samsung.com>
Fri, 26 Feb 2016 00:22:36 +0000 (17:22 -0700)
Fix to print information returned by ioctl only when
it returns success.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
tools/testing/selftests/media_tests/media_device_test.c

index a47880b9e00ab000d45679f68fc7e9028aa58670..7a4d613f4742c4faff9fcc62e7ca1f103a60921c 100644 (file)
@@ -86,8 +86,9 @@ int main(int argc, char **argv)
                ret = ioctl(fd, MEDIA_IOC_DEVICE_INFO, &mdi);
                if (ret < 0)
                        printf("Media Device Info errno %s\n", strerror(errno));
-               printf("Media device model %s driver %s\n",
-                       mdi.model, mdi.driver);
+               else
+                       printf("Media device model %s driver %s\n",
+                               mdi.model, mdi.driver);
                sleep(10);
                count++;
        }