linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] hwmon: (pmbus/ibm-cffps) Add new manufacturer debugfs entries
@ 2020-01-07 13:32 Dan Carpenter
  2020-01-07 13:53 ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2020-01-07 13:32 UTC (permalink / raw)
  To: eajames; +Cc: linux-hwmon

Hello Eddie James,

The patch bb3c0a27ed1d: "hwmon: (pmbus/ibm-cffps) Add new
manufacturer debugfs entries" from Dec 19, 2019, leads to the
following static checker warning:

	drivers/hwmon/pmbus/ibm-cffps.c:257 ibm_cffps_debugfs_write()
	error: uninitialized symbol 'data'.

drivers/hwmon/pmbus/ibm-cffps.c
   238  static ssize_t ibm_cffps_debugfs_write(struct file *file,
   239                                         const char __user *buf, size_t count,
   240                                         loff_t *ppos)
   241  {
   242          u8 data;
   243          ssize_t rc;
   244          int *idxp = file->private_data;
   245          int idx = *idxp;
   246          struct ibm_cffps *psu = to_psu(idxp, idx);
   247  
   248          switch (idx) {
   249          case CFFPS_DEBUGFS_ON_OFF_CONFIG:
   250                  pmbus_set_page(psu->client, 0);
   251  
   252                  rc = simple_write_to_buffer(&data, 1, ppos, buf, count);
                                                    ^^^^^^^^^^^^^^
If "ppos >= 1" then "data" isn't initialized but "rc" is zero.

   253                  if (rc < 0)
   254                          return rc;
   255  
   256                  rc = i2c_smbus_write_byte_data(psu->client,
   257                                                 PMBUS_ON_OFF_CONFIG, data);
   258                  if (rc)
   259                          return rc;
   260  
   261                  rc = 1;
   262                  break;
   263          default:
   264                  return -EINVAL;
   265          }
   266  
   267          return rc;
   268  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-07 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07 13:32 [bug report] hwmon: (pmbus/ibm-cffps) Add new manufacturer debugfs entries Dan Carpenter
2020-01-07 13:53 ` Guenter Roeck
2020-01-07 15:08   ` Eddie James

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