diff mbox

[U-Boot,v2] net: Return -EINTR when ctrl+c is pressed

Message ID cf180cb2f2dfe759d6a61bff7a6fca967cabf9fa.1440139786.git.michal.simek@xilinx.com
State Accepted
Delegated to: Joe Hershberger
Headers show

Commit Message

Michal Simek Aug. 21, 2015, 6:49 a.m. UTC
Current behavior is that if CTRL+C is pressed command returns 0 that was
successful which is not correct behavior.
The easiest test case is "tftpboot 80000 uImage && echo yes"
and press CTRL+C. Then the second command is called which is incorrect.

Error log:
zynq-uboot> tftpb 80000 uImage && echo yes
Gem.e000b000:7 is connected to Gem.e000b000.  Reconnecting to
Gem.e000b000
Gem.e000b000 Waiting for PHY auto negotiation to complete....... done
Using Gem.e000b000 device
TFTP from server 192.168.0.102; our IP address is 192.168.0.101
Filename 'uImage'.
Load address: 0x80000
Loading: ################
Abort
yes
zynq-uboot>

This patch adds -EINTR return value when CTRL+C is pressed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
---

Changes in v2:
- Change patch subject
- Change return value from -1 to -EINTR

 net/net.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Joe Hershberger Aug. 21, 2015, 9:21 p.m. UTC | #1
Hi Michal,

On Fri, Aug 21, 2015 at 1:49 AM, Michal Simek <michal.simek@xilinx.com> wrote:
> Current behavior is that if CTRL+C is pressed command returns 0 that was
> successful which is not correct behavior.
> The easiest test case is "tftpboot 80000 uImage && echo yes"
> and press CTRL+C. Then the second command is called which is incorrect.
>
> Error log:
> zynq-uboot> tftpb 80000 uImage && echo yes
> Gem.e000b000:7 is connected to Gem.e000b000.  Reconnecting to
> Gem.e000b000
> Gem.e000b000 Waiting for PHY auto negotiation to complete....... done
> Using Gem.e000b000 device
> TFTP from server 192.168.0.102; our IP address is 192.168.0.101
> Filename 'uImage'.
> Load address: 0x80000
> Loading: ################
> Abort
> yes
> zynq-uboot>
>
> This patch adds -EINTR return value when CTRL+C is pressed.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Michal Simek Aug. 24, 2015, 7:11 a.m. UTC | #2
Hi Joe,

On 08/21/2015 11:21 PM, Joe Hershberger wrote:
> Hi Michal,
> 
> On Fri, Aug 21, 2015 at 1:49 AM, Michal Simek <michal.simek@xilinx.com> wrote:
>> Current behavior is that if CTRL+C is pressed command returns 0 that was
>> successful which is not correct behavior.
>> The easiest test case is "tftpboot 80000 uImage && echo yes"
>> and press CTRL+C. Then the second command is called which is incorrect.
>>
>> Error log:
>> zynq-uboot> tftpb 80000 uImage && echo yes
>> Gem.e000b000:7 is connected to Gem.e000b000.  Reconnecting to
>> Gem.e000b000
>> Gem.e000b000 Waiting for PHY auto negotiation to complete....... done
>> Using Gem.e000b000 device
>> TFTP from server 192.168.0.102; our IP address is 192.168.0.101
>> Filename 'uImage'.
>> Load address: 0x80000
>> Loading: ################
>> Abort
>> yes
>> zynq-uboot>
>>
>> This patch adds -EINTR return value when CTRL+C is pressed.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> Reviewed-by: Tom Rini <trini@konsulko.com>
> 
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> 

are you going to take it via net tree or do you want Tom to take it
directly?

Thanks,
Michal
Joe Hershberger Aug. 24, 2015, 2:51 p.m. UTC | #3
On Fri, Aug 21, 2015 at 1:49 AM, Michal Simek <michal.simek@xilinx.com> wrote:
> Current behavior is that if CTRL+C is pressed command returns 0 that was
> successful which is not correct behavior.
> The easiest test case is "tftpboot 80000 uImage && echo yes"
> and press CTRL+C. Then the second command is called which is incorrect.
>
> Error log:
> zynq-uboot> tftpb 80000 uImage && echo yes
> Gem.e000b000:7 is connected to Gem.e000b000.  Reconnecting to
> Gem.e000b000
> Gem.e000b000 Waiting for PHY auto negotiation to complete....... done
> Using Gem.e000b000 device
> TFTP from server 192.168.0.102; our IP address is 192.168.0.101
> Filename 'uImage'.
> Load address: 0x80000
> Loading: ################
> Abort
> yes
> zynq-uboot>
>
> This patch adds -EINTR return value when CTRL+C is pressed.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot-net, thanks!
-Joe
diff mbox

Patch

diff --git a/net/net.c b/net/net.c
index 67e0ad297cf5..2a6efd85eae2 100644
--- a/net/net.c
+++ b/net/net.c
@@ -565,6 +565,7 @@  restart:
 			/* include a debug print as well incase the debug
 			   messages are directed to stderr */
 			debug_cond(DEBUG_INT_STATE, "--- net_loop Abort!\n");
+			ret = -EINTR;
 			goto done;
 		}