From: Jiri Pirko <jiri@resnulli.us>
To: Or Gerlitz <gerlitz.or@gmail.com>
Cc: Linux Netdev List <netdev@vger.kernel.org>,
David Miller <davem@davemloft.net>
Subject: Re: [patch net-next v2 4/6] mlxsw: core: Implement temperature hwmon interface
Date: Wed, 2 Dec 2015 23:25:52 +0100 [thread overview]
Message-ID: <20151202222551.GP2355@nanopsycho.orion> (raw)
In-Reply-To: <CAJ3xEMhGv9nTq+CtpX=e4E+4WpipVnc---EUOEqxJ06xOSBsog@mail.gmail.com>
Wed, Dec 02, 2015 at 11:05:48PM CET, gerlitz.or@gmail.com wrote:
>On Sun, Nov 29, 2015 at 12:49 PM, Jiri Pirko <jiri@resnulli.us> wrote:
>> Sun, Nov 29, 2015 at 10:04:07AM CET, gerlitz.or@gmail.com wrote:
>>>[..]
>>>> +enum mlxsw_hwmon_attr_type {
>>>> + MLXSW_HWMON_ATTR_TYPE_TEMP,
>>>> + MLXSW_HWMON_ATTR_TYPE_TEMP_MAX,
>>>> +};
>>>> +
>>>> +static void mlxsw_hwmon_attr_add(struct mlxsw_hwmon *mlxsw_hwmon,
>>>> + enum mlxsw_hwmon_attr_type attr_type,
>>>> + unsigned int type_index, unsigned int num) {
>>>> + struct mlxsw_hwmon_attr *mlxsw_hwmon_attr;
>>>> + unsigned int attr_index;
>>>> +
>>>> + attr_index = mlxsw_hwmon->attrs_count;
>>>> + mlxsw_hwmon_attr = &mlxsw_hwmon->hwmon_attrs[attr_index];
>>>> +
>>>> + switch (attr_type) {
>>>> + case MLXSW_HWMON_ATTR_TYPE_TEMP:
>>>> + mlxsw_hwmon_attr->dev_attr.show = mlxsw_hwmon_temp_show;
>>>> + mlxsw_hwmon_attr->dev_attr.attr.mode = S_IRUGO;
>>>> + snprintf(mlxsw_hwmon_attr->name, sizeof(mlxsw_hwmon_attr->name),
>>>> + "temp%u_input", num + 1);
>>>> + break;
>>>> + case MLXSW_HWMON_ATTR_TYPE_TEMP_MAX:
>>>> + mlxsw_hwmon_attr->dev_attr.show = mlxsw_hwmon_temp_max_show;
>>>> + mlxsw_hwmon_attr->dev_attr.attr.mode = S_IRUGO;
>>>> + snprintf(mlxsw_hwmon_attr->name, sizeof(mlxsw_hwmon_attr->name),
>>>> + "temp%u_highest", num + 1);
>>>> + break;
>>>> + default:
>>>> + BUG();
>>>
>>> Guys, do we really have to crash the whole system just b/c somehow an
>>> unknown value propagated here during **init** time?
>>>
>>> I don't think so.
>
>> "default" case simply *cannot* happen. If it happens, it is a stack
>> corruption or some other fatal problem. I believe that BUG is
>> appropriate at these cases.
>
>Jiri, as Dave commented today on the LAG series, BUG_ON() is bad and
>is only to ever be used when the kernel's continued operation is
>absolutely impossible, can we change here to WARN_ON() or a like?
In this case, I don't know how to bail out correctly, I believe that
bugon is correct here.
Again, there is no possible way to achieve this bugon, other than a
stack corruption. I don't think we should try to cope with a stack
corruption.
Feel free to send a patch if you think otherwise.
Thanks.
next prev parent reply other threads:[~2015-12-02 22:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 12:45 [patch net-next v2 0/6] mlxsw: driver update Jiri Pirko
2015-11-27 12:45 ` [patch net-next v2 1/6] mlxsw: reg: Add Management LED Control register definition Jiri Pirko
2015-11-27 12:45 ` [patch net-next v2 2/6] mlxsw: spectrum: Add support for port identification Jiri Pirko
2015-11-27 12:45 ` [patch net-next v2 3/6] mlxsw: reg: Add definition of temperature management registers Jiri Pirko
2015-11-27 12:45 ` [patch net-next v2 4/6] mlxsw: core: Implement temperature hwmon interface Jiri Pirko
2015-11-29 9:04 ` Or Gerlitz
2015-11-29 10:49 ` Jiri Pirko
2015-12-02 22:05 ` Or Gerlitz
2015-12-02 22:25 ` Jiri Pirko [this message]
2015-12-02 22:28 ` David Miller
2015-12-02 22:35 ` Jiri Pirko
2015-12-02 23:37 ` David Miller
2015-12-03 8:19 ` Jiri Pirko
2015-12-03 9:32 ` Or Gerlitz
2015-12-03 9:55 ` Jiri Pirko
2015-11-27 12:45 ` [patch net-next v2 5/6] mlxsw: reg: Add definition of fan management registers Jiri Pirko
2015-11-27 12:45 ` [patch net-next v2 6/6] mlxsw: core: Implement fan control using hwmon Jiri Pirko
2015-11-30 20:06 ` [patch net-next v2 0/6] mlxsw: driver update David Miller
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=20151202222551.GP2355@nanopsycho.orion \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=gerlitz.or@gmail.com \
--cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox