Hi Cristian,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linux/master]
[also build test WARNING on soc/for-next linus/master v5.8-rc1 next-20200618]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url:
https://github.com/0day-ci/linux/commits/Cristian-Marussi/SCMI-Notificati...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
1b5044021070efa3259f3e9548dc35d1eb6aa844
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce (this is a W=1 build):
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
drivers/firmware/arm_scmi/notify.c: In function 'scmi_register_protocol_events':
> drivers/firmware/arm_scmi/notify.c:294:31: warning: comparison is
always false due to limited range of data type [-Wtype-limits]
294 | if (!ops ||
!evt || proto_id >= SCMI_MAX_PROTO)
| ^~
vim +294 drivers/firmware/arm_scmi/notify.c
263
264 /**
265 * scmi_register_protocol_events() - Register Protocol Events with the core
266 * @handle: The handle identifying the platform instance against which the
267 * the protocol's events are registered
268 * @proto_id: Protocol ID
269 * @queue_sz: Size in bytes of the associated queue to be allocated
270 * @ops: Protocol specific event-related operations
271 * @evt: Event descriptor array
272 * @num_events: Number of events in @evt array
273 * @num_sources: Number of possible sources for this protocol on this
274 * platform.
275 *
276 * Used by SCMI Protocols initialization code to register with the notification
277 * core the list of supported events and their descriptors: takes care to
278 * pre-allocate and store all needed descriptors, scratch buffers and event
279 * queues.
280 *
281 * Return: 0 on Success
282 */
283 int scmi_register_protocol_events(const struct scmi_handle *handle,
284 u8 proto_id, size_t queue_sz,
285 const struct scmi_event_ops *ops,
286 const struct scmi_event *evt, int num_events,
287 int num_sources)
288 {
289 int i;
290 size_t payld_sz = 0;
291 struct scmi_registered_events_desc *pd;
292 struct scmi_notify_instance *ni;
293
294 if (!ops || !evt || proto_id >= SCMI_MAX_PROTO)
295 return -EINVAL;
296
297 /* Ensure notify_priv is updated */
298 smp_rmb();
299 if (unlikely(!handle->notify_priv))
300 return -ENOMEM;
301 ni = handle->notify_priv;
302
303 /* Attach to the notification main devres group */
304 if (!devres_open_group(ni->handle->dev, ni->gid, GFP_KERNEL))
305 return -ENOMEM;
306
307 for (i = 0; i < num_events; i++)
308 payld_sz = max_t(size_t, payld_sz, evt[i].max_payld_sz);
309 pd = scmi_allocate_registered_events_desc(ni, proto_id, queue_sz,
310 sizeof(struct scmi_event_header) + payld_sz,
311 num_events, ops);
312 if (IS_ERR(pd))
313 goto err;
314
315 for (i = 0; i < num_events; i++, evt++) {
316 struct scmi_registered_event *r_evt;
317
318 r_evt = devm_kzalloc(ni->handle->dev, sizeof(*r_evt),
319 GFP_KERNEL);
320 if (!r_evt)
321 goto err;
322 r_evt->proto = pd;
323 r_evt->evt = evt;
324
325 r_evt->sources = devm_kcalloc(ni->handle->dev, num_sources,
326 sizeof(refcount_t), GFP_KERNEL);
327 if (!r_evt->sources)
328 goto err;
329 r_evt->num_sources = num_sources;
330 mutex_init(&r_evt->sources_mtx);
331
332 r_evt->report = devm_kzalloc(ni->handle->dev,
333 evt->max_report_sz, GFP_KERNEL);
334 if (!r_evt->report)
335 goto err;
336
337 pd->registered_events[i] = r_evt;
338 /* Ensure events are updated */
339 smp_wmb();
340 dev_dbg(handle->dev, "registered event - %lX\n",
341 MAKE_ALL_SRCS_KEY(r_evt->proto->id, r_evt->evt->id));
342 }
343
344 /* Register protocol and events...it will never be removed */
345 ni->registered_protocols[proto_id] = pd;
346 /* Ensure protocols are updated */
347 smp_wmb();
348
349 devres_close_group(ni->handle->dev, ni->gid);
350
351 return 0;
352
353 err:
354 dev_warn(handle->dev, "Proto:%X - Registration Failed !\n",
proto_id);
355 /* A failing protocol registration does not trigger full failure */
356 devres_close_group(ni->handle->dev, ni->gid);
357
358 return -ENOMEM;
359 }
360
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org