From: Dan Carpenter <dan.carpenter@oracle.com>
To: sudeep.holla@arm.com
Cc: linux-hwmon@vger.kernel.org
Subject: [bug report] hwmon: add support for sensors exported via ARM SCMI
Date: Mon, 12 Mar 2018 17:17:50 +0300 [thread overview]
Message-ID: <20180312141750.GA10360@mwanda> (raw)
Hello Sudeep Holla,
The patch b23688aefb8b: "hwmon: add support for sensors exported via
ARM SCMI" from Jun 15, 2017, leads to the following static checker
warning:
drivers/hwmon/scmi-hwmon.c:141 scmi_hwmon_probe()
warn: passing zero to 'PTR_ERR'
drivers/hwmon/scmi-hwmon.c
111 static int scmi_hwmon_probe(struct scmi_device *sdev)
112 {
113 int i, idx;
114 u16 nr_sensors;
115 enum hwmon_sensor_types type;
116 struct scmi_sensors *scmi_sensors;
117 const struct scmi_sensor_info *sensor;
118 int nr_count[hwmon_max] = {0}, nr_types = 0;
119 const struct hwmon_chip_info *chip_info;
120 struct device *hwdev, *dev = &sdev->dev;
121 struct hwmon_channel_info *scmi_hwmon_chan;
122 const struct hwmon_channel_info **ptr_scmi_ci;
123 const struct scmi_handle *handle = sdev->handle;
124
125 if (!handle || !handle->sensor_ops)
126 return -ENODEV;
127
128 nr_sensors = handle->sensor_ops->count_get(handle);
129 if (!nr_sensors)
130 return -EIO;
131
132 scmi_sensors = devm_kzalloc(dev, sizeof(*scmi_sensors), GFP_KERNEL);
133 if (!scmi_sensors)
134 return -ENOMEM;
135
136 scmi_sensors->handle = handle;
137
138 for (i = 0; i < nr_sensors; i++) {
139 sensor = handle->sensor_ops->info_get(handle, i);
140 if (!sensor)
141 return PTR_ERR(sensor);
^^^^^^
This means "return 0;" which obviously isn't right, but I don't know the
currect error code to return.
142
143 switch (sensor->type) {
144 case TEMPERATURE_C:
145 case VOLTAGE:
146 case CURRENT:
147 case POWER:
148 case ENERGY:
149 type = scmi_types[sensor->type];
150 if (!nr_count[type])
151 nr_types++;
152 nr_count[type]++;
153 break;
154 }
regards,
dan carpenter
reply other threads:[~2018-03-12 14:18 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=20180312141750.GA10360@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=sudeep.holla@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox