Commit 2409a869 authored by Alexandre Belloni's avatar Alexandre Belloni Committed by Greg Kroah-Hartman

selftests: rtc: rtctest: fix alarm tests

[ Upstream commit fdac9448 ]

Return values for select are not checked properly and timeouts may not be
detected.
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: default avatarShuah Khan <shuah@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 4670e839
...@@ -145,15 +145,12 @@ TEST_F(rtc, alarm_alm_set) { ...@@ -145,15 +145,12 @@ TEST_F(rtc, alarm_alm_set) {
rc = select(self->fd + 1, &readfds, NULL, NULL, &tv); rc = select(self->fd + 1, &readfds, NULL, NULL, &tv);
ASSERT_NE(-1, rc); ASSERT_NE(-1, rc);
EXPECT_NE(0, rc); ASSERT_NE(0, rc);
/* Disable alarm interrupts */ /* Disable alarm interrupts */
rc = ioctl(self->fd, RTC_AIE_OFF, 0); rc = ioctl(self->fd, RTC_AIE_OFF, 0);
ASSERT_NE(-1, rc); ASSERT_NE(-1, rc);
if (rc == 0)
return;
rc = read(self->fd, &data, sizeof(unsigned long)); rc = read(self->fd, &data, sizeof(unsigned long));
ASSERT_NE(-1, rc); ASSERT_NE(-1, rc);
TH_LOG("data: %lx", data); TH_LOG("data: %lx", data);
...@@ -202,7 +199,7 @@ TEST_F(rtc, alarm_wkalm_set) { ...@@ -202,7 +199,7 @@ TEST_F(rtc, alarm_wkalm_set) {
rc = select(self->fd + 1, &readfds, NULL, NULL, &tv); rc = select(self->fd + 1, &readfds, NULL, NULL, &tv);
ASSERT_NE(-1, rc); ASSERT_NE(-1, rc);
EXPECT_NE(0, rc); ASSERT_NE(0, rc);
rc = read(self->fd, &data, sizeof(unsigned long)); rc = read(self->fd, &data, sizeof(unsigned long));
ASSERT_NE(-1, rc); ASSERT_NE(-1, rc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment