From: Jean Delvare Date: Tue, 09 Nov 2010 09:14:36 +0000 Subject: Re: [lm-sensors] [PATCH] hwmon: (gpio-fan) Fix fan_ctrl_init error Message-Id: <20101109101436.4346ea3b@endymion.delvare> List-Id: References: <1289279919.14461.7.camel@mola> <20101109090147.155dd1e9@endymion.delvare> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: axel.lin@gmail.com Cc: linux-kernel , Guenter Roeck , Simon Guinot , lm-sensors@lm-sensors.org On Tue, 9 Nov 2010 16:22:02 +0800, Axel Lin wrote: > 2010/11/9 Jean Delvare : > > On Tue, 09 Nov 2010 13:18:39 +0800, Axel Lin wrote: > >> Remove sysfs entries before return -ENODEV. > >> > >> Signed-off-by: Axel Lin > >> --- > >> =A0drivers/hwmon/gpio-fan.c | =A0 =A04 +++- > >> =A01 files changed, 3 insertions(+), 1 deletions(-) > >> > >> diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c > >> index aa701a1..d2e66b4 100644 > >> --- a/drivers/hwmon/gpio-fan.c > >> +++ b/drivers/hwmon/gpio-fan.c > >> @@ -388,11 +388,13 @@ static int fan_ctrl_init(struct gpio_fan_data *f= an_data, > >> =A0 =A0 =A0 fan_data->speed_index =3D get_fan_speed_index(fan_data); > >> =A0 =A0 =A0 if (fan_data->speed_index < 0) { > >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D -ENODEV; > >> - =A0 =A0 =A0 =A0 =A0 =A0 goto err_free_gpio; > >> + =A0 =A0 =A0 =A0 =A0 =A0 goto err_remove_sysfs; > >> =A0 =A0 =A0 } > >> > >> =A0 =A0 =A0 return 0; > >> > >> +err_remove_sysfs: > >> + =A0 =A0 sysfs_remove_group(&pdev->dev.kobj, &gpio_fan_ctrl_group); > >> =A0err_free_gpio: > >> =A0 =A0 =A0 for (i =3D i - 1; i >=3D 0; i--) > >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 gpio_free(ctrl[i]); > > > > Oh, and while you're here, fan_alarm_init() needs some love as well. > > There's a "return 0" in the middle which clearly can't be correct. > I think this part is correct. see the comment: > /* > * If the alarm GPIO don't support interrupts, just leave > * without initializing the fail notification support. > */ Oops, my bad. I should have read the comments before blaming the author :( --=20 Jean Delvare _______________________________________________ lm-sensors mailing list lm-sensors@lm-sensors.org http://lists.lm-sensors.org/mailman/listinfo/lm-sensors