linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: eajames@linux.ibm.com
Cc: linux-hwmon@vger.kernel.org
Subject: [bug report] hwmon: (pmbus/ibm-cffps) Add new manufacturer debugfs entries
Date: Tue, 7 Jan 2020 16:32:35 +0300	[thread overview]
Message-ID: <20200107133235.ug54ssy5bqpg3qp3@kili.mountain> (raw)

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

             reply	other threads:[~2020-01-07 13:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 13:32 Dan Carpenter [this message]
2020-01-07 13:53 ` [bug report] hwmon: (pmbus/ibm-cffps) Add new manufacturer debugfs entries Guenter Roeck
2020-01-07 15:08   ` Eddie James

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=20200107133235.ug54ssy5bqpg3qp3@kili.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=eajames@linux.ibm.com \
    --cc=linux-hwmon@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;
as well as URLs for NNTP newsgroup(s).