linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [bug report] hwmon: (ibmpowernv) Add attributes to enable/disable sensor groups
@ 2019-08-20 12:34 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2019-08-20 12:34 UTC (permalink / raw)
  To: shilpa.bhat; +Cc: linuxppc-dev

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-20 13:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 12:34 [bug report] hwmon: (ibmpowernv) Add attributes to enable/disable sensor groups Dan Carpenter

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).