Check the return values of send_control() and send_line_coding() during
device initialization in gb_uart_probe(). If these operations fail, the
device will be left in an inconsistent state, so propagate the error to
properly fail the probe.
Both functions call gb_operation_sync() which can fail with errors such
as -ENOMEM, -ENODEV, or -ETIMEDOUT. Ignoring these errors means the TTY
device would be registered despite incomplete initialization.
Signed-off-by: Nirbhay Sharma <nirbhay.lkd(a)gmail.com>
---
drivers/staging/greybus/uart.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
index 10df5c37c83e..5cece0a6606f 100644
--- a/drivers/staging/greybus/uart.c
+++ b/drivers/staging/greybus/uart.c
@@ -879,14 +879,18 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev,
if (retval)
goto exit_put_port;
- send_control(gb_tty, gb_tty->ctrlout);
+ retval = send_control(gb_tty, gb_tty->ctrlout);
+ if (retval)
+ goto exit_connection_disable;
/* initialize the uart to be 9600n81 */
gb_tty->line_coding.rate = cpu_to_le32(9600);
gb_tty->line_coding.format = GB_SERIAL_1_STOP_BITS;
gb_tty->line_coding.parity = GB_SERIAL_NO_PARITY;
gb_tty->line_coding.data_bits = 8;
- send_line_coding(gb_tty);
+ retval = send_line_coding(gb_tty);
+ if (retval)
+ goto exit_connection_disable;
retval = gb_connection_enable(connection);
if (retval)
--
2.48.1
On Thu, Nov 13, 2025 at 10:12:00PM +0800, Chang Junzheng wrote:
> From: Chang Junzheng <guagua210311(a)outlook.com>
>
> Fix checkpatch.pl warning by changing envp array declaration to
> static const char * const. This improves code safety and follows
> kernel coding style recommendations.
>
> Signed-off-by: Chang Junzheng <guagua210311(a)qq.com>
> Changes in v2:
> - Restored original indentation of array elements
> - Only changed the array declaration as originally intended
The "Changes" goes below the --- line, as per the documentation.
thanks,
greg k-h
On Thu, Nov 13, 2025 at 09:39:54PM +0800, cjz_VM wrote:
> Hi Greg,
>
> Thanks for reviewing my patch!
>
> For sending twice: I apologize for the duplicate. After the first send, I realized I had missed some greybus-specific maintainers, so I resent to include them all.
Then that should have been a v2 patch :)
> For the indentation: You're right to ask about it. When I changed the declaration from 'char *envp[]' to 'static const char * const envp[]', the opening bracket moved to the right due to the longer declaration. I added tabs to keep the array elements aligned with the opening bracket, following the kernel coding style rule that parameters should align with the opening parenthesis.
>
> If this alignment approach is not preferred, I'm happy to adjust it to whatever style you recommend.
You did not document your change, and it had nothing really to do with
the const change, so I would not recommend doing this.
Also, please do not top-post, and be sure to properly wrap your lines in
your email client.
thanks,
greg k-h