drivers: rtc: ds3231: drop impossible negative id check

rtc_ds3231_alarm_set_callback() takes an unsigned alarm id, making
the negative value check impossible.

The id < 0 condition is therefore dead code and can never be true.
Remove it and keep only the upper bound check.

No functional change intended.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
This commit is contained in:
Gaetan Perrot
2026-01-09 02:08:02 +09:00
committed by Alberto Escolar
parent 769ac1b112
commit b14f7e9e9f

View File

@@ -608,7 +608,7 @@ static int rtc_ds3231_get_alarm_states(const struct device *dev, bool *states)
static int rtc_ds3231_alarm_set_callback(const struct device *dev, uint16_t id,
rtc_alarm_callback cb, void *user_data)
{
if (id < 0 || id >= ALARM_COUNT) {
if (id >= ALARM_COUNT) {
return -EINVAL;
}