From: Dan Carpenter <dan.carpenter@oracle.com>
To: shilpa.bhat@linux.vnet.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Subject: [bug report] hwmon: (ibmpowernv) Add attributes to enable/disable sensor groups
Date: Tue, 20 Aug 2019 15:34:07 +0300 [thread overview]
Message-ID: <20190820123407.GA10773@mwanda> (raw)
Hello Shilpasri G Bhat,
The patch e0da99123f3c: "hwmon: (ibmpowernv) Add attributes to
enable/disable sensor groups" from Jul 24, 2018, leads to the
following static checker warning:
drivers/hwmon/ibmpowernv.c:353 init_sensor_group_data()
warn: missing error code here? 'sgrp()' failed. 'ret' = '0'
drivers/hwmon/ibmpowernv.c
334 static int init_sensor_group_data(struct platform_device *pdev,
335 struct platform_data *pdata)
336 {
337 struct sensor_group_data *sgrp_data;
338 struct device_node *groups, *sgrp;
339 int count = 0, ret = 0;
340 enum sensors type;
341
342 groups = of_find_compatible_node(NULL, NULL, "ibm,opal-sensor-group");
343 if (!groups)
344 return ret;
To me the intent would be more clear if we said "return 0;". I look at
that I think maybe it's a bug.
345
346 for_each_child_of_node(groups, sgrp) {
347 type = get_sensor_type(sgrp);
348 if (type != MAX_SENSOR_TYPE)
349 pdata->nr_sensor_groups++;
350 }
351
352 if (!pdata->nr_sensor_groups)
353 goto out;
And here? Is this still a success path?
354
355 sgrp_data = devm_kcalloc(&pdev->dev, pdata->nr_sensor_groups,
356 sizeof(*sgrp_data), GFP_KERNEL);
357 if (!sgrp_data) {
358 ret = -ENOMEM;
359 goto out;
360 }
361
362 for_each_child_of_node(groups, sgrp) {
363 u32 gid;
364
365 type = get_sensor_type(sgrp);
regards,
dan carpenter
reply other threads:[~2019-08-20 13:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20190820123407.GA10773@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=shilpa.bhat@linux.vnet.ibm.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.