Re: rtc02: skip (TCONF) on read-only RTCs that reject RTC_SET_TIME

[email protected]
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
Hi Kuba,

On Thu, 16 Jul 2026, Kuba Pawlak wrote:
> rtc02: skip (TCONF) on read-only RTCs that reject RTC_SET_TIME

> +	if (tst_rtc_settime(rtc_dev, &probe_tm)) {
> +		if (errno == ENODEV || errno == EOPNOTSUPP ||
> +		    errno == EINVAL || errno == EACCES || errno == EPERM)
> +			tst_brk(TCONF | TERRNO,
> +				"RTC does not support setting the time");
> +
> +	    tst_brk(TBROK | TERRNO, "ioctl() RTC_SET_TIME");
> +	}

The fallthrough tst_brk() line uses a tab followed by four spaces instead
of two tabs. Everything else in the block uses tabs only; this one line
mixes whitespace.

Verdict - Needs revision

Pre-existing issues:

tst_rtc_ioctl() in lib/tst_rtctime.c does not close rtc_fd when ioctl()
fails:

    ret = ioctl(rtc_fd, request, rtc_tm);
    if (ret != 0)
        return -1;   /* rtc_fd leaked */

The new probe in rtc_setup() deliberately exercises this error path on
read-only devices, so on the hardware this patch targets the fd opened by
SAFE_OPEN() is leaked on every test run.

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.