Re: [PATCH 03/13] serial: don't use uninitialized value in uart_poll_init()

From: Jiri Slaby
Date: Thu Aug 08 2024 - 03:34:48 EST


On 05. 08. 24, 17:46, Doug Anderson wrote:
@@ -2717,10 +2716,10 @@ static int uart_poll_init(struct tty_driver *driver, int line, char *options)
ret = uart_set_options(port, NULL, baud, parity, bits, flow);
console_list_unlock();
}
-out:
+
if (ret)
uart_change_pm(state, pm_state);
- mutex_unlock(&tport->mutex);
+
return ret;
}

This too needs #include.

Why? I see in "mutex.h" (which is already included by serial_core.c):

DEFINE_GUARD(mutex, struct mutex *, mutex_lock(_T), mutex_unlock(_T))

...so we're using the mutex guard and including the header file that
defines the mutex guard. Seems like it's all legit to me.

The patches got merged. But I can post a fix on top, of course. But, what is the consensus here -- include or not to include? I assume mutex.h includes cleanup.h already due to the above guard definition.

thanks,
--
js
suse labs