mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mark M. Hoffman" <mhoffman@lightlink.com>
To: Dmitry Torokhov <dtor@insightbb.com>
Cc: Jean Delvare <khali@linux-fr.org>, Andrew Morton <akpm@osdl.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Michal Piotrowski <michal.k.k.piotrowski@gmail.com>,
	lm-sensors@lm-sensors.org
Subject: Re: [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error handling
Date: Tue, 22 Aug 2006 07:34:47 -0400	[thread overview]
Message-ID: <20060822113447.GA28702@jupiter.solarsys.private> (raw)
In-Reply-To: <200608212043.06256.dtor@insightbb.com>

Hi Dmitry:

* Dmitry Torokhov <dtor@insightbb.com> [2006-08-21 20:43:05 -0400]:
> On Monday 21 August 2006 04:04, Jean Delvare wrote:
> > > --- linux-work-clean/drivers/hwmon/w83627hf.c	2006-08-20 22:02:40.000000000 +0200
> > > +++ linux-work/drivers/hwmon/w83627hf.c	2006-08-20 22:27:14.000000000 +0200
> > > @@ -513,9 +513,21 @@ static DEVICE_ATTR(in0_max, S_IRUGO | S_
> > > 
> > >  #define device_create_file_in(client, offset) \
> > >  do { \
> > > -device_create_file(&client->dev, &dev_attr_in##offset##_input); \
> > > -device_create_file(&client->dev, &dev_attr_in##offset##_min); \
> > > -device_create_file(&client->dev, &dev_attr_in##offset##_max); \
> > > +	err = device_create_file(&client->dev, &dev_attr_in##offset##_input); \
> > > +	if (err) {\
> > > +		hwmon_device_unregister(data->class_dev); \
> > > +		return err; \
> > > +	} \
> > > +	err = device_create_file(&client->dev, &dev_attr_in##offset##_min); \
> > > +	if (err) {\
> > > +		hwmon_device_unregister(data->class_dev); \
> > > +		return err; \
> > > +	} \
> > > +	err = device_create_file(&client->dev, &dev_attr_in##offset##_max); \
> > > +	if (err) {\
> > > +		hwmon_device_unregister(data->class_dev); \
> > > +		return err; \
> > > +	} \
> > >  } while (0)
> > 
> > _Never_ use "return" in a macro. It's way too confusing for whoever will
> > read the code later.
> >
> 
> Also I believe it is good practice to remove created attributes explicitely
> instead of relying on sysfs to do the cleanup - I beliee Greg was going to
> remove it from sysfs at some point of time... 

Yep: the patches that are floating on the lm-sensors mailing list do fix this
also.  Again, see here:

http://lists.lm-sensors.org/pipermail/lm-sensors/2006-August/017204.html

Regards,

-- 
Mark M. Hoffman
mhoffman@lightlink.com


      reply	other threads:[~2006-08-22 11:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-20 20:44 Michal Piotrowski
2006-08-20 21:49 ` [lm-sensors] " jim.cromie
2006-08-20 22:12   ` Michal Piotrowski
2006-08-20 22:28 ` Alan Cox
2006-08-21  2:30 ` [lm-sensors] " Mark M. Hoffman
2006-08-21  9:11   ` Jean Delvare
2006-08-21 16:46     ` Grant Coady
2006-08-21  8:04 ` Jean Delvare
2006-08-22  0:43   ` Dmitry Torokhov
2006-08-22 11:34     ` Mark M. Hoffman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060822113447.GA28702@jupiter.solarsys.private \
    --to=mhoffman@lightlink.com \
    --cc=akpm@osdl.org \
    --cc=dtor@insightbb.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=michal.k.k.piotrowski@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome