Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH v3] staging: greybus: uart: return tty_alloc_driver() errors
@ 2026-07-14 13:49 Alfie Varghese
  2026-07-14 14:46 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Alfie Varghese @ 2026-07-14 13:49 UTC (permalink / raw)
  To: johan, elder, gregkh
  Cc: greybus-dev, linux-staging, linux-kernel, dan.carpenter, error27,
	alfievarghese22

gb_tty_init() maps any tty_alloc_driver() failure to -ENOMEM.
tty_alloc_driver() currently always returns -ENOMEM on failure,
so this does not change behavior in practice. However, returning
PTR_ERR(gb_tty_driver) is more correct and consistent with kernel
conventions, preserving any future error codes the function might
return.

Signed-off-by: Alfie Varghese <alfievarghese22@gmail.com>
---
v3: resend, v2 was corrupted in transit. No code changes.
v2: updated commit message per Dan Carpenter's review to clarify
    that tty_alloc_driver() currently only returns -ENOMEM, making
    this a style fix rather than a behavioral change.
---
 drivers/staging/greybus/uart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
index 7d060b4cd33d..24b4dab069c3 100644
--- a/drivers/staging/greybus/uart.c
+++ b/drivers/staging/greybus/uart.c
@@ -951,7 +951,7 @@ static int gb_tty_init(void)
 					 TTY_DRIVER_DYNAMIC_DEV);
 	if (IS_ERR(gb_tty_driver)) {
 		pr_err("Can not allocate tty driver\n");
-		retval = -ENOMEM;
+		retval = PTR_ERR(gb_tty_driver);
 		goto fail_unregister_dev;
 	}
 
-- 
2.54.0.windows.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] staging: greybus: uart: return tty_alloc_driver() errors
  2026-07-14 13:49 [PATCH v3] staging: greybus: uart: return tty_alloc_driver() errors Alfie Varghese
@ 2026-07-14 14:46 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2026-07-14 14:46 UTC (permalink / raw)
  To: Alfie Varghese
  Cc: johan, elder, gregkh, greybus-dev, linux-staging, linux-kernel,
	dan.carpenter

On Tue, Jul 14, 2026 at 07:19:21PM +0530, Alfie Varghese wrote:
> gb_tty_init() maps any tty_alloc_driver() failure to -ENOMEM.
> tty_alloc_driver() currently always returns -ENOMEM on failure,
> so this does not change behavior in practice. However, returning
> PTR_ERR(gb_tty_driver) is more correct and consistent with kernel
> conventions, preserving any future error codes the function might
> return.
> 
> Signed-off-by: Alfie Varghese <alfievarghese22@gmail.com>
> ---

Thanks!

Reviewed-by: Dan Carpenter <error27@gmail.com>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-14 14:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14 13:49 [PATCH v3] staging: greybus: uart: return tty_alloc_driver() errors Alfie Varghese
2026-07-14 14:46 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox