[hwmon:hwmon-playground 3/12] drivers/hwmon/pmbus/pmbus_core.c:174:18: warning: address of array 'data->info->phases' will always evaluate to 'true'

0 views
Skip to first unread message

kbuild test robot

unread,
Feb 2, 2020, 9:55:37 PM2/2/20
to kbu...@lists.01.org, Nick Desaulniers, clang-bu...@googlegroups.com
CC: kbuil...@lists.01.org
CC: linux...@vger.kernel.org
TO: Guenter Roeck <li...@roeck-us.net>

tree: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-playground
head: 4e5fc259a7d202d7e13818052a6cdaff0f602b35
commit: 4e87220ea3c48bcb3aeadc4000acf9bcc7aa7522 [3/12] hwmon: (pmbus) Implement multi-phase support
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project ba8110161dfb096bbc63039afd87ff6417328f91)
reproduce:
git checkout 4e87220ea3c48bcb3aeadc4000acf9bcc7aa7522
# save the attached .config to linux build tree
make ARCH=x86_64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <l...@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/hwmon/pmbus/pmbus_core.c:174:18: warning: address of array 'data->info->phases' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (data->info->phases && data->currphase != phase &&
~~~~~~~~~~~~^~~~~~ ~~
1 warning generated.

vim +174 drivers/hwmon/pmbus/pmbus_core.c

150
151 int pmbus_set_page(struct i2c_client *client, int page, int phase)
152 {
153 struct pmbus_data *data = i2c_get_clientdata(client);
154 int rv;
155
156 if (page < 0)
157 return 0;
158
159 if (!(data->info->func[page] & PMBUS_PAGE_VIRTUAL) &&
160 data->info->pages > 1 && page != data->currpage) {
161 rv = i2c_smbus_write_byte_data(client, PMBUS_PAGE, page);
162 if (rv < 0)
163 return rv;
164
165 rv = i2c_smbus_read_byte_data(client, PMBUS_PAGE);
166 if (rv < 0)
167 return rv;
168
169 if (rv != page)
170 return -EIO;
171 }
172 data->currpage = page;
173
> 174 if (data->info->phases && data->currphase != phase &&
175 !(data->info->pfunc[phase] & PMBUS_PHASE_VIRTUAL)) {
176 rv = i2c_smbus_write_byte_data(client, PMBUS_PHASE,
177 phase);
178 if (rv)
179 return rv;
180 }
181 data->currphase = phase;
182
183 return 0;
184 }
185 EXPORT_SYMBOL_GPL(pmbus_set_page);
186

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuil...@lists.01.org Intel Corporation
.config.gz

Nick Desaulniers

unread,
Feb 3, 2020, 10:00:30 AM2/3/20
to Guenter Roeck, kbu...@lists.01.org, clang-built-linux, kbuild test robot, kbuil...@lists.01.org, vad...@mellanox.com
https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?h=hwmon-playground&id=ec31c1832ca6505f46d068e87a0524cd21e468b4

+ Guenter, looks legit, can you please take a look? phases is an
array member of a struct, so it can never be NULL.
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-li...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/202002031044.RnwQP6Bt%25lkp%40intel.com.



--
Thanks,
~Nick Desaulniers

Guenter Roeck

unread,
Feb 3, 2020, 10:09:08 AM2/3/20
to Nick Desaulniers, kbu...@lists.01.org, clang-built-linux, kbuild test robot, kbuil...@lists.01.org, vad...@mellanox.com
On 2/3/20 7:00 AM, Nick Desaulniers wrote:
> https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?h=hwmon-playground&id=ec31c1832ca6505f46d068e87a0524cd21e468b4
>
> + Guenter, looks legit, can you please take a look? phases is an
> array member of a struct, so it can never be NULL.
>

Hi Nick,

Thanks for the note; already reported twice or so ;-), and fixed.

Guenter
Reply all
Reply to author
Forward
0 new messages