From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Warren Date: Tue, 08 Jan 2008 16:10:20 -0500 Subject: [U-Boot-Users] [PATCH] NET: Proper return code handling in eth_init() function in file eth.c In-Reply-To: <200801081826.49556.sr@denx.de> References: <47838F20.6020905@gmail.com> <200801081826.49556.sr@denx.de> Message-ID: <4783E6BC.8000205@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Stefan Roese wrote: > On Tuesday 08 January 2008, Ben Warren wrote: > >>> Probably i got the reason why this is happening. As a convention that >>> is usually followed, the code in eth_init() function in the file eth.c >>> was reworked to handle 0 in case of Success and any non zero value in >>> case of an error. >>> >>> Most of the Ethernet driver's init routines adhere to the same >>> convention of returning a 0 on Success and a non zero value in case of >>> error. However, the driver you might be using, may be returning a non >>> zero value on Successful initialization, that is why the problem is >>> arising. The solution could be to return 0 in case of Success, from >>> the Ethernet driver's init() routine. >>> >>> Thanks!! >>> >>> -- >>> Regards, >>> Upakul Barkakaty >>> >> Yeah, looks like ppc_4xx_eth_init() (cpu/ppc4xx/4xx_enet.c) returns 1 on >> success and -1 on failure. I don't have hardware to test this. Can you >> check it out Stefan? Let's look through the other drivers to see if >> this is an isolated case. >> > > I'm back now and will give it a try this evening. Thanks for pointing this > out. > > Note: This patch may trigger other platform ethernet driver problems as well. > So I strongly encourage all platform maintainers/custodians to check if a > change in the return code of the ethernet driver is needed. > > Best regards, > Stefan > Don't waste too much time on this - every driver returns 1 on success. I'm putting together a patch to clean things up and should have it within an hour or so. regards, Ben