mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] greybus: gb-beagleplay: Add error handling for gb_greybus_init
@ 2025-01-20 14:05 Wentao Liang
  2025-01-20 14:42 ` Ayush Singh
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2025-01-20 14:05 UTC (permalink / raw)
  To: gregkh
  Cc: elder, johan, ayush, lee, francesco.dolcini, viro, linux-kernel,
	Wentao Liang

Add error handling for the gb_greybus_init(bg) function call
during the firmware reflash process to maintain consistency
in error handling throughout the codebase. If initialization
fails, log an error and return FW_UPLOAD_ERR_RW_ERROR.

Fixes: 0cf7befa3ea2 ("greybus: gb-beagleplay: Add firmware upload API")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/greybus/gb-beagleplay.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/greybus/gb-beagleplay.c b/drivers/greybus/gb-beagleplay.c
index 473ac3f2d382..da31f1131afc 100644
--- a/drivers/greybus/gb-beagleplay.c
+++ b/drivers/greybus/gb-beagleplay.c
@@ -912,7 +912,9 @@ static enum fw_upload_err cc1352_prepare(struct fw_upload *fw_upload,
 		cc1352_bootloader_reset(bg);
 		WRITE_ONCE(bg->flashing_mode, false);
 		msleep(200);
-		gb_greybus_init(bg);
+		if (gb_greybus_init(bg) < 0)
+			return dev_err_probe(&bg->sd->dev, FW_UPLOAD_ERR_RW_ERROR,
+					     "Failed to initialize greybus");
 		gb_beagleplay_start_svc(bg);
 		return FW_UPLOAD_ERR_FW_INVALID;
 	}
-- 
2.42.0.windows.2


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

* Re: [PATCH] greybus: gb-beagleplay: Add error handling for gb_greybus_init
  2025-01-20 14:05 [PATCH] greybus: gb-beagleplay: Add error handling for gb_greybus_init Wentao Liang
@ 2025-01-20 14:42 ` Ayush Singh
  0 siblings, 0 replies; 2+ messages in thread
From: Ayush Singh @ 2025-01-20 14:42 UTC (permalink / raw)
  To: Wentao Liang, gregkh
  Cc: elder, johan, lee, francesco.dolcini, viro, linux-kernel

On 1/20/25 19:35, Wentao Liang wrote:

> Add error handling for the gb_greybus_init(bg) function call
> during the firmware reflash process to maintain consistency
> in error handling throughout the codebase. If initialization
> fails, log an error and return FW_UPLOAD_ERR_RW_ERROR.
>
> Fixes: 0cf7befa3ea2 ("greybus: gb-beagleplay: Add firmware upload API")
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>   drivers/greybus/gb-beagleplay.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/greybus/gb-beagleplay.c b/drivers/greybus/gb-beagleplay.c
> index 473ac3f2d382..da31f1131afc 100644
> --- a/drivers/greybus/gb-beagleplay.c
> +++ b/drivers/greybus/gb-beagleplay.c
> @@ -912,7 +912,9 @@ static enum fw_upload_err cc1352_prepare(struct fw_upload *fw_upload,
>   		cc1352_bootloader_reset(bg);
>   		WRITE_ONCE(bg->flashing_mode, false);
>   		msleep(200);
> -		gb_greybus_init(bg);
> +		if (gb_greybus_init(bg) < 0)
> +			return dev_err_probe(&bg->sd->dev, FW_UPLOAD_ERR_RW_ERROR,
> +					     "Failed to initialize greybus");
>   		gb_beagleplay_start_svc(bg);
>   		return FW_UPLOAD_ERR_FW_INVALID;
>   	}

Looks good to me.

Reviewed-by: Ayush Singh <ayush@beagleboard.org>


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

end of thread, other threads:[~2025-01-20 14:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-20 14:05 [PATCH] greybus: gb-beagleplay: Add error handling for gb_greybus_init Wentao Liang
2025-01-20 14:42 ` Ayush Singh

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

all inboxes | Powered by JetHome®