Re: [PATCH 2.6.27-rc3] led: driver for LEDs on PCEngines ALIX.2 and ALIX.3 boards

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Stefan Richter
Date: Sunday, August 24, 2008 - 3:08 am

Andrew Morton wrote:
...
...
...


Really?  Constantin's code looks correct to me.  He increments i once 
more after failure.

Perhaps write it easier to read; i.e. in the same way as most error 
return checks everywhere in the kernel:

	for (i = 0; i < ARRAY_SIZE(alix_leds); i++) {
		ret = led_classdev_register(...etc...);
		if (ret < 0)
			break;
	}

	if (ret < 0)
		while (i--)
			led_classdev_unregister(&alix_leds[i].cdev);


Or		while (--i >= 0)

or		for (i--; i >= 0; i--)
-- 
Stefan Richter
-=====-==--- =--- ==---
http://arcgraph.de/sr/
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2.6.27-rc3] led: driver for LEDs on PCEngines ALIX. ..., Constantin Baranov, (Tue Aug 19, 10:23 am)
Re: [PATCH 2.6.27-rc3] led: driver for LEDs on PCEngines A ..., Constantin Baranov, (Fri Aug 22, 2:08 pm)
Re: [PATCH 2.6.27-rc3] led: driver for LEDs on PCEngines A ..., Constantin Baranov, (Sat Aug 23, 10:11 am)
Re: [PATCH 2.6.27-rc3] led: driver for LEDs on PCEngines A ..., Stefan Richter, (Sun Aug 24, 3:08 am)