diff mbox series

cmd: adc: Report return value on error

Message ID 20211220182345.52e0d6f9.samuel@dionne-riel.com
State Accepted
Commit 4a05497a8ce9292017b7a5d0e48ecc45705a0a4b
Delegated to: Tom Rini
Headers show
Series cmd: adc: Report return value on error | expand

Commit Message

Samuel Dionne-Riel Dec. 20, 2021, 11:23 p.m. UTC
Reporting the return value should always be done on error conditions,
this way the developer can start debugging issues with more knowledge
in-hand.

Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
---
 cmd/adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tom Rini Jan. 15, 2022, 12:38 p.m. UTC | #1
On Mon, Dec 20, 2021 at 06:23:45PM -0500, Samuel Dionne-Riel wrote:

> Reporting the return value should always be done on error conditions,
> this way the developer can start debugging issues with more knowledge
> in-hand.
> 
> Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/cmd/adc.c b/cmd/adc.c
index 16f914a030..75739bc8ee 100644
--- a/cmd/adc.c
+++ b/cmd/adc.c
@@ -81,8 +81,8 @@  static int do_adc_single(struct cmd_tbl *cmdtp, int flag, int argc,
 	ret = adc_channel_single_shot(argv[1], simple_strtol(argv[2], NULL, 0),
 				      &data);
 	if (ret) {
-		printf("Error getting single shot for device %s channel %s\n",
-		       argv[1], argv[2]);
+		printf("Error getting single shot for device %s channel %s (ret=%d)\n",
+		       argv[1], argv[2], ret);
 		return CMD_RET_FAILURE;
 	}