public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Cc: Andrew Morton <akpm@osdl.org>,
	lm-sensors@lm-sensors.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error handling
Date: Mon, 21 Aug 2006 10:04:16 +0200	[thread overview]
Message-ID: <20060821100416.4d356328.khali@linux-fr.org> (raw)
In-Reply-To: <44E8C9AE.3060307@gmail.com>

> --- 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.

-- 
Jean Delvare

  parent reply	other threads:[~2006-08-21  8:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-20 20:44 [RFC][PATCH] hwmon:fix sparse warnings + error handling 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 [this message]
2006-08-22  0:43   ` Dmitry Torokhov
2006-08-22 11:34     ` Mark M. Hoffman

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=20060821100416.4d356328.khali@linux-fr.org \
    --to=khali@linux-fr.org \
    --cc=akpm@osdl.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