From: khali@linux-fr.org (Jean Delvare)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH 2.6.18-rc4-mm3] hwmon: unchecked return
Date: Wed, 30 Aug 2006 11:01:28 +0000 [thread overview]
Message-ID: <20060830130128.26c1966e.khali@linux-fr.org> (raw)
In-Reply-To: <20060830030502.GA5104@jupiter.solarsys.private>
Hi Mark,
> This patch fixes up some hwmon drivers so that they no longer ignore
> return status from device_create_file(). Compile-tested only.
Looks good to me, I'd only have two minor comments (I always do, it
seems...) No need to resend this patch (unless you want to), but you
may want to take them into account for later patches.
> +++ linux-2.6.18-rc4-mm3/drivers/hwmon/lm80.c
> @@ -394,6 +394,48 @@ static int lm80_attach_adapter(struct i2
> return i2c_probe(adapter, &addr_data, lm80_detect);
> }
>
> +static struct attribute *lm80_attributes[] = {
> + &dev_attr_in0_min.attr,
> + &dev_attr_in1_min.attr,
> + &dev_attr_in2_min.attr,
> + &dev_attr_in3_min.attr,
> + &dev_attr_in4_min.attr,
> + &dev_attr_in5_min.attr,
> + &dev_attr_in6_min.attr,
> + &dev_attr_in0_max.attr,
> + &dev_attr_in1_max.attr,
> + &dev_attr_in2_max.attr,
> + &dev_attr_in3_max.attr,
> + &dev_attr_in4_max.attr,
> + &dev_attr_in5_max.attr,
> + &dev_attr_in6_max.attr,
> + &dev_attr_in0_input.attr,
> + &dev_attr_in1_input.attr,
> + &dev_attr_in2_input.attr,
> + &dev_attr_in3_input.attr,
> + &dev_attr_in4_input.attr,
> + &dev_attr_in5_input.attr,
> + &dev_attr_in6_input.attr,
> + &dev_attr_fan1_min.attr,
> + &dev_attr_fan2_min.attr,
> + &dev_attr_fan1_input.attr,
> + &dev_attr_fan2_input.attr,
> + &dev_attr_fan1_div.attr,
> + &dev_attr_fan2_div.attr,
> + &dev_attr_temp1_input.attr,
> + &dev_attr_temp1_max.attr,
> + &dev_attr_temp1_max_hyst.attr,
> + &dev_attr_temp1_crit.attr,
> + &dev_attr_temp1_crit_hyst.attr,
> + &dev_attr_alarms.attr,
> +
> + NULL
> +};
If you were grouping the attributes visually as you did in some other
drivers, I agree it would make (some) sense to have a blank line before
the NULL terminator. However, with a single block of attributes, it's a
bit harder to justify this last blank line.
> /* The ADT7463 has an optional VRM 10 mode where pin 21 is used
> as a sixth digital VID input rather than an analog input. */
> data->vid = lm85_read_value(new_client, LM85_REG_VID);
> - if (!(kind = adt7463 && (data->vid & 0x80))) {
> - device_create_file(&new_client->dev, &dev_attr_in4_input);
> - device_create_file(&new_client->dev, &dev_attr_in4_min);
> - device_create_file(&new_client->dev, &dev_attr_in4_max);
> + if (!(kind = adt7463 && (data->vid & 0x80)))
> + if ((err = device_create_file(&new_client->dev,
> + &dev_attr_in4_input))
> + || (err = device_create_file(&new_client->dev,
> + &dev_attr_in4_min))
> + || (err = device_create_file(&new_client->dev,
> + &dev_attr_in4_max)))
> + goto ERROR3;
As a maintainer, I don't much like nested "if"s without curly braces,
especially when the conditions span over multiple lines. It's very easy
to mess up when later trying to add an "else" clause to the outer-most
"if". Thus I'd recommend to keep the curly braces for the outer-most
"if" in this case. If nothing else, it also makes the patch a couple
lines smaller ;)
Thanks,
--
Jean Delvare
next prev parent reply other threads:[~2006-08-30 11:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-30 3:05 [lm-sensors] [PATCH 2.6.18-rc4-mm3] hwmon: unchecked return status Mark M. Hoffman
2006-08-30 11:01 ` Jean Delvare [this message]
2006-08-31 1:50 ` Mark M. Hoffman
2006-08-31 18:56 ` [lm-sensors] [PATCH 2.6.18-rc4-mm3] hwmon: unchecked return Jean Delvare
2006-09-03 13:07 ` Jean Delvare
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=20060830130128.26c1966e.khali@linux-fr.org \
--to=khali@linux-fr.org \
--cc=lm-sensors@vger.kernel.org \
/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.