From: Seung-Woo Kim Date: Fri, 24 Apr 2020 07:40:40 +0000 (+0900) Subject: gadget: f_thor: Return proper error value for thor_init() X-Git-Tag: submit/tizen/20201110.005738~98 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=340c99565ce396c14bf5caac5612b1cd66595d64;p=platform%2Fkernel%2Fu-boot.git gadget: f_thor: Return proper error value for thor_init() After the commit 17679aed622b ("usb: thor: add screen support"), caller of thor_init() expects general error value to check interrupt by Ctrl-C but thor_init() returns wrong error value -1 for Ctrl-C termination during rx or wrong protocol response. Return proper error for the cases. Change-Id: I8a637918930673bad953a88e26c79b8e64580bc8 Signed-off-by: Seung-Woo Kim --- diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c index 0482bab847..0c167cb6f2 100644 --- a/drivers/usb/gadget/f_thor.c +++ b/drivers/usb/gadget/f_thor.c @@ -724,6 +724,7 @@ int thor_init(void) struct thor_dev *dev = thor_func->dev; int power_key_cnt = 0; size_t received; + int ret; #ifdef CONFIG_TIZEN #ifdef CONFIG_LCD /* TODO : Need to enable LCD*/ @@ -763,9 +764,10 @@ int thor_init(void) #endif /* CONFIG_TIZEN */ thor_set_dma(thor_rx_data_buf, strlen("THOR")); /* detect the download request from Host PC */ - if (thor_rx_data(&received) < 0) { + ret = thor_rx_data(&received); + if (ret < 0) { printf("%s: Data not received!\n", __func__); - return -1; + return ret; } if (!strncmp((char *)thor_rx_data_buf, "THOR", strlen("THOR"))) { @@ -776,7 +778,7 @@ int thor_init(void) thor_tx_data(thor_tx_data_buf, strlen("ROHT")); } else { puts("Wrong reply information\n"); - return -1; + return -EPROTO; } return 0;