diff mbox

[U-Boot] net: Return -1 when ctrl+c is pressed

Message ID a4b4d8853d1a7ae4eccc0f7779cb9e880802aff2.1439451971.git.michal.simek@xilinx.com
State Superseded
Delegated to: Joe Hershberger
Headers show

Commit Message

Michal Simek Aug. 13, 2015, 7:46 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 -1 return value when CTRL+C is pressed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Not sure if -1 is the right error code but I have parsed the code and it
looks like that -1 is standard behavior for CTRL+C. But I am happy to
change this behavior.

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

Comments

Michal Simek Aug. 20, 2015, 12:15 p.m. UTC | #1
On 08/13/2015 09:46 AM, Michal Simek 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 -1 return value when CTRL+C is pressed.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> 
> Not sure if -1 is the right error code but I have parsed the code and it
> looks like that -1 is standard behavior for CTRL+C. But I am happy to
> change this behavior.
> 
> ---
>  net/net.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/net.c b/net/net.c
> index 67e0ad297cf5..738a0db8c2ba 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 = -1;
>  			goto done;
>  		}
>  
> 

Joe, Tom: Any update on this one?

Thanks,
Michal
Joe Hershberger Aug. 20, 2015, 4:51 p.m. UTC | #2
Hi Michal,

On Thu, Aug 20, 2015 at 7:15 AM, Michal Simek <monstr@monstr.eu> wrote:
> On 08/13/2015 09:46 AM, Michal Simek 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 -1 return value when CTRL+C is pressed.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>> Not sure if -1 is the right error code but I have parsed the code and it
>> looks like that -1 is standard behavior for CTRL+C. But I am happy to
>> change this behavior.
>>
>> ---
>>  net/net.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/net/net.c b/net/net.c
>> index 67e0ad297cf5..738a0db8c2ba 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 = -1;

Please replace this with -EINTR.

>>                       goto done;
>>               }
>>
>>
>
> Joe, Tom: Any update on this one?

Slipped through... thanks for the reminder.
Tom Rini Aug. 20, 2015, 4:51 p.m. UTC | #3
On Thu, Aug 20, 2015 at 02:15:27PM +0200, Michal Simek wrote:
> On 08/13/2015 09:46 AM, Michal Simek 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 -1 return value when CTRL+C is pressed.
> > 
> > Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> > ---
> > 
> > Not sure if -1 is the right error code but I have parsed the code and it
> > looks like that -1 is standard behavior for CTRL+C. But I am happy to
> > change this behavior.
> > 
> > ---
> >  net/net.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/net/net.c b/net/net.c
> > index 67e0ad297cf5..738a0db8c2ba 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 = -1;
> >  			goto done;
> >  		}
> >  
> > 
> 
> Joe, Tom: Any update on this one?

Reviewed-by: Tom Rini <trini@konsulko.com>

Joe, do you want to pick this up?  Thanks!
Michal Simek Aug. 21, 2015, 7:37 a.m. UTC | #4
On 08/20/2015 06:51 PM, Joe Hershberger wrote:
> Hi Michal,
> 
> On Thu, Aug 20, 2015 at 7:15 AM, Michal Simek <monstr@monstr.eu> wrote:
>> On 08/13/2015 09:46 AM, Michal Simek 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 -1 return value when CTRL+C is pressed.
>>>
>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>> ---
>>>
>>> Not sure if -1 is the right error code but I have parsed the code and it
>>> looks like that -1 is standard behavior for CTRL+C. But I am happy to
>>> change this behavior.
>>>
>>> ---
>>>  net/net.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/net/net.c b/net/net.c
>>> index 67e0ad297cf5..738a0db8c2ba 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 = -1;
> 
> Please replace this with -EINTR.
> 
>>>                       goto done;
>>>               }
>>>
>>>
>>
>> Joe, Tom: Any update on this one?
> 
> Slipped through... thanks for the reminder.

v2 sent.

Thanks,
Michal
diff mbox

Patch

diff --git a/net/net.c b/net/net.c
index 67e0ad297cf5..738a0db8c2ba 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 = -1;
 			goto done;
 		}