From: khali@linux-fr.org (Jean Delvare)
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: [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error
Date: Mon, 21 Aug 2006 08:04:16 +0000 [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
WARNING: multiple messages have this Message-ID (diff)
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
next prev parent reply other threads:[~2006-08-21 8:04 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-20 20:44 [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error handling Michal Piotrowski
2006-08-20 20:44 ` Michal Piotrowski
2006-08-20 21:49 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error jim.cromie at gmail.com
2006-08-20 21:49 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error handling jim.cromie
2006-08-20 22:12 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error Michal Piotrowski
2006-08-20 22:12 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error handling Michal Piotrowski
2006-08-20 22:28 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error Alan Cox
2006-08-20 22:28 ` [RFC][PATCH] hwmon:fix sparse warnings + error handling Alan Cox
2006-08-21 2:30 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error Mark M. Hoffman
2006-08-21 2:30 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error handling Mark M. Hoffman
2006-08-21 9:11 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error Jean Delvare
2006-08-21 9:11 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error handling Jean Delvare
2006-08-21 16:46 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error Grant Coady
2006-08-21 16:46 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error handling Grant Coady
2006-08-21 8:04 ` Jean Delvare [this message]
2006-08-21 8:04 ` Jean Delvare
2006-08-22 0:43 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error Dmitry Torokhov
2006-08-22 0:43 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error handling Dmitry Torokhov
2006-08-22 11:34 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error Mark M. Hoffman
2006-08-22 11:34 ` [lm-sensors] [RFC][PATCH] hwmon:fix sparse warnings + error handling 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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.