openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Zev Weiss <zev@bewilderbeest.net>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org, openbmc@lists.ozlabs.org,
	Jean Delvare <jdelvare@suse.com>,
	linux-kernel@vger.kernel.org, Renze Nicolai <renze@rnplus.nl>
Subject: Re: [PATCH 1/5] hwmon: (nct6775) Rearrange attr-group initialization
Date: Mon, 28 Feb 2022 00:24:07 -0800	[thread overview]
Message-ID: <YhyGp0zu9OBOWt/M@hatter.bewilderbeest.net> (raw)
In-Reply-To: <b4a1d4e1-a7b9-00f9-75d2-56003138883f@roeck-us.net>

On Sun, Feb 27, 2022 at 07:01:32AM PST, Guenter Roeck wrote:
>On 2/26/22 05:30, Zev Weiss wrote:
>>We now track the number of attribute groups in nct6775_data, as a
>>measure to simplify handling differences in the set of enabled
>>attribute groups between nct6775 drivers (platform & i2c).  As a side
>>effect, we also reduce the amount of IS_ERR()/PTR_ERR() boilerplate a
>>bit.
>>
>>Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
>>---
>>  drivers/hwmon/nct6775.c | 84 ++++++++++++++++++++---------------------
>>  1 file changed, 42 insertions(+), 42 deletions(-)
>>
>>diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
>>index 2b91f7e05126..139b2fe5ca4d 100644
>>--- a/drivers/hwmon/nct6775.c
>>+++ b/drivers/hwmon/nct6775.c
>>@@ -1198,6 +1198,7 @@ struct nct6775_data {
>>  	const char *name;
>>  	const struct attribute_group *groups[7];
>>+	u8 num_groups;
>>  	u16 reg_temp[5][NUM_TEMP]; /* 0=temp, 1=temp_over, 2=temp_hyst,
>>  				    * 3=temp_crit, 4=temp_lcrit
>>@@ -1405,10 +1406,18 @@ struct sensor_template_group {
>>  	int base;
>>  };
>>-static struct attribute_group *
>>-nct6775_create_attr_group(struct device *dev,
>>-			  const struct sensor_template_group *tg,
>>-			  int repeat)
>>+static int nct6775_add_attr_group(struct nct6775_data *data, const struct attribute_group *group)
>>+{
>>+	/* Need to leave a NULL terminator at the end of data->groups */
>>+	if (WARN_ON(data->num_groups == ARRAY_SIZE(data->groups) - 1))
>>+		return -ENOSPC;
>>+
>
>At work we are struggling with a whopping 500,000+ (!) WARN backtraces
>_each day_. I would be happy if you send me patches removing some of
>those, but I am not inclined to accept patches adding them. If people
>don't notice that the driver doesn't load, they won't notice the warning
>either, and it will just add to all the other warning backtrace noise.
>

Okay, I can remove that -- I mostly just added it out of concern that 
"no space left on device" would be a fairly confusing error for someone 
to potentially end up with modprobe reporting, and some further 
indication of what went wrong could perhaps make it less mystifying 
(though yes, with any luck it can hopefully remain unreachable in 
practice as long as data->groups gets expanded when needed).

I'd certainly also be open to suggestions of a more appropriate errno 
value to return in that case, though I couldn't find one that seemed 
clearly better to me.  ENOMEM seemed vaguely more appropriate in some 
ways given that it's an in-memory array that's full rather than a 
storage device, but it's also definitely not the usual ENOMEM meaning of 
a dynamic allocation failure due to memory pressure, so...(shrug).  I 
think FreedBSD's got an EDOOFUS errno value, but as far as I can see 
Linux doesn't have one for indicating a purely internal error like this.


Thanks,
Zev


  reply	other threads:[~2022-02-28  8:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-26 13:30 [PATCH 0/5] hwmon: (nct6775) Add i2c support Zev Weiss
2022-02-26 13:30 ` [PATCH 1/5] hwmon: (nct6775) Rearrange attr-group initialization Zev Weiss
2022-02-27 15:01   ` Guenter Roeck
2022-02-28  8:24     ` Zev Weiss [this message]
2022-02-28 15:16       ` Guenter Roeck
2022-02-26 13:30 ` [PATCH 2/5] hwmon: (nct6775) Add read-only mode Zev Weiss
2022-02-26 13:30 ` [PATCH 3/5] hwmon: (nct6775) Split core and platform driver Zev Weiss
2022-02-26 13:30 ` [PATCH 4/5] dt-bindings: hwmon: Add nuvoton,nct6775 Zev Weiss
2022-02-27 10:58   ` Krzysztof Kozlowski
2022-02-26 13:30 ` [PATCH 5/5] hwmon: (nct6775) Add i2c driver Zev Weiss
2022-02-26 22:47 ` [PATCH 0/5] hwmon: (nct6775) Add i2c support Zev Weiss
2022-02-26 23:54 ` Guenter Roeck
2022-02-27 12:25   ` Zev Weiss
2022-02-27  0:14 ` Oleksandr Natalenko
2022-02-27  0:27   ` Zev Weiss
2022-02-27 21:38     ` Oleksandr Natalenko
2022-02-28  2:48       ` Zev Weiss

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=YhyGp0zu9OBOWt/M@hatter.bewilderbeest.net \
    --to=zev@bewilderbeest.net \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=openbmc@lists.ozlabs.org \
    --cc=renze@rnplus.nl \
    /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;
as well as URLs for NNTP newsgroup(s).