Просмотр исходного кода

selftests: media_dcevice_test fix to handle ioctl failure case

Fix to print information returned by ioctl only when
it returns success.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Shuah Khan 9 лет назад
Родитель
Сommit
36d3f7d820
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      tools/testing/selftests/media_tests/media_device_test.c

+ 3 - 2
tools/testing/selftests/media_tests/media_device_test.c

@@ -86,8 +86,9 @@ int main(int argc, char **argv)
 		ret = ioctl(fd, MEDIA_IOC_DEVICE_INFO, &mdi);
 		ret = ioctl(fd, MEDIA_IOC_DEVICE_INFO, &mdi);
 		if (ret < 0)
 		if (ret < 0)
 			printf("Media Device Info errno %s\n", strerror(errno));
 			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);
 		sleep(10);
 		count++;
 		count++;
 	}
 	}