Re: [PATCH net-next v3] net: Add Qcom WWAN control driver

kernel test robot
2021-03-09T10:11:40Z

[-- Attachment #1: Type: text/plain, Size: 9149 bytes --]

Hi Loic,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url: https://github.com/0day-ci/linux/commits/Loic-Poulain/net-Add-Qcom-WWAN-control-driver/20210309-163643
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git d310ec03a34e92a77302edb804f7d68ee4f01ba0
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f4fcd3ed7ac5f29a28988eed9f5516f874073802
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Loic-Poulain/net-Add-Qcom-WWAN-control-driver/20210309-163643
git checkout f4fcd3ed7ac5f29a28988eed9f5516f874073802
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

In file included from include/linux/kernel.h:10,
from drivers/net/wwan/mhi_wwan_ctrl.c:4:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/m68k/include/asm/page_mm.h:174:49: warning: ordered comparison of pointer with null pointer [-Wextra]
174 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:137:2: note: in expansion of macro 'BUG_ON'
137 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:137:10: note: in expansion of macro 'virt_addr_valid'
137 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
In file included from include/linux/kernel.h:14,
from drivers/net/wwan/mhi_wwan_ctrl.c:4:
drivers/net/wwan/mhi_wwan_ctrl.c: In function 'mhi_wwan_ctrl_probe':
>> drivers/net/wwan/mhi_wwan_ctrl.c:442:48: error: 'MHI_MAX_MTU' undeclared (first use in this function); did you mean 'ETH_MAX_MTU'?
442 | wwandev->mtu = min_t(size_t, id->driver_data, MHI_MAX_MTU);
| ^~~~~~~~~~~
include/linux/minmax.h:18:39: note: in definition of macro '__typecheck'
18 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^
include/linux/minmax.h:42:24: note: in expansion of macro '__safe_cmp'
42 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:110:27: note: in expansion of macro '__careful_cmp'
110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
| ^~~~~~~~~~~~~
drivers/net/wwan/mhi_wwan_ctrl.c:442:17: note: in expansion of macro 'min_t'
442 | wwandev->mtu = min_t(size_t, id->driver_data, MHI_MAX_MTU);
| ^~~~~
drivers/net/wwan/mhi_wwan_ctrl.c:442:48: note: each undeclared identifier is reported only once for each function it appears in
442 | wwandev->mtu = min_t(size_t, id->driver_data, MHI_MAX_MTU);
| ^~~~~~~~~~~
include/linux/minmax.h:18:39: note: in definition of macro '__typecheck'
18 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^
include/linux/minmax.h:42:24: note: in expansion of macro '__safe_cmp'
42 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:110:27: note: in expansion of macro '__careful_cmp'
110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
| ^~~~~~~~~~~~~
drivers/net/wwan/mhi_wwan_ctrl.c:442:17: note: in expansion of macro 'min_t'
442 | wwandev->mtu = min_t(size_t, id->driver_data, MHI_MAX_MTU);
| ^~~~~
include/linux/minmax.h:42:2: error: first argument to '__builtin_choose_expr' not a constant
42 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:110:27: note: in expansion of macro '__careful_cmp'
110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
| ^~~~~~~~~~~~~
drivers/net/wwan/mhi_wwan_ctrl.c:442:17: note: in expansion of macro 'min_t'
442 | wwandev->mtu = min_t(size_t, id->driver_data, MHI_MAX_MTU);
| ^~~~~
drivers/net/wwan/mhi_wwan_ctrl.c: At top level:
>> drivers/net/wwan/mhi_wwan_ctrl.c:504:53: error: 'MHI_MAX_MTU' undeclared here (not in a function); did you mean 'ETH_MAX_MTU'?
504 | { .chan = MHI_WWAN_CTRL_PROTO_QCDM, .driver_data = MHI_MAX_MTU },
| ^~~~~~~~~~~
| ETH_MAX_MTU

vim +442 drivers/net/wwan/mhi_wwan_ctrl.c

409
410 static int mhi_wwan_ctrl_probe(struct mhi_device *mhi_dev,
411 const struct mhi_device_id *id)
412 {
413 struct mhi_wwan_dev *wwandev;
414 struct device *dev;
415 int index, err;
416
417 /* Create mhi_wwan data context */
418 wwandev = kzalloc(sizeof(*wwandev), GFP_KERNEL);
419 if (!wwandev)
420 return -ENOMEM;
421
422 /* Retrieve index */
423 mutex_lock(&mhi_wwan_ctrl_drv_lock);
424 index = idr_alloc(&mhi_wwan_ctrl_idr, wwandev, 0,
425 MHI_WWAN_CTRL_MAX_MINORS, GFP_KERNEL);
426 mutex_unlock(&mhi_wwan_ctrl_drv_lock);
427 if (index < 0) {
428 err = index;
429 goto err_free_wwandev;
430 }
431
432 /* Init mhi_wwan data */
433 kref_init(&wwandev->ref_count);
434 mutex_init(&wwandev->mhi_dev_lock);
435 mutex_init(&wwandev->write_lock);
436 init_waitqueue_head(&wwandev->ul_wq);
437 init_waitqueue_head(&wwandev->dl_wq);
438 spin_lock_init(&wwandev->dl_queue_lock);
439 INIT_LIST_HEAD(&wwandev->dl_queue);
440 wwandev->mhi_dev = mhi_dev;
441 wwandev->minor = index;
> 442 wwandev->mtu = min_t(size_t, id->driver_data, MHI_MAX_MTU);
443 set_bit(MHI_WWAN_CONNECTED, &wwandev->flags);
444
445 if (mhi_dev->dl_chan)
446 set_bit(MHI_WWAN_DL_CAP, &wwandev->flags);
447 if (mhi_dev->ul_chan)
448 set_bit(MHI_WWAN_UL_CAP, &wwandev->flags);
449
450 dev_set_drvdata(&mhi_dev->dev, wwandev);
451
452 /* Creates a new device and registers it with sysfs */
453 dev = device_create(mhi_wwan_ctrl_class, &mhi_dev->dev,
454 MKDEV(mhi_wwan_ctrl_major, index), wwandev,
455 "wwan_%s", dev_name(&mhi_dev->dev));
456 if (IS_ERR(dev)) {
457 err = PTR_ERR(dev);
458 goto err_free_idr;
459 }
460
461 return 0;
462
463 err_free_idr:
464 mutex_lock(&mhi_wwan_ctrl_drv_lock);
465 idr_remove(&mhi_wwan_ctrl_idr, wwandev->minor);
466 mutex_unlock(&mhi_wwan_ctrl_drv_lock);
467 err_free_wwandev:
468 kfree(wwandev);
469 dev_set_drvdata(&mhi_dev->dev, NULL);
470
471 return err;
472 };
473
474 static void mhi_wwan_ctrl_remove(struct mhi_device *mhi_dev)
475 {
476 struct mhi_wwan_dev *wwandev = dev_get_drvdata(&mhi_dev->dev);
477
478 dev_set_drvdata(&mhi_dev->dev, NULL);
479
480 mutex_lock(&mhi_wwan_ctrl_drv_lock);
481 idr_remove(&mhi_wwan_ctrl_idr, wwandev->minor);
482 mutex_unlock(&mhi_wwan_ctrl_drv_lock);
483
484 clear_bit(MHI_WWAN_CONNECTED, &wwandev->flags);
485 device_destroy(mhi_wwan_ctrl_class, MKDEV(mhi_wwan_ctrl_major, wwandev->minor));
486
487 /* Unlink mhi_dev from mhi_wwan_dev */
488 mutex_lock(&wwandev->mhi_dev_lock);
489 wwandev->mhi_dev = NULL;
490 mutex_unlock(&wwandev->mhi_dev_lock);
491
492 /* wake up any blocked user */
493 wake_up_interruptible(&wwandev->dl_wq);
494 wake_up_interruptible(&wwandev->ul_wq);
495
496 kref_put(&wwandev->ref_count, mhi_wwan_ctrl_dev_release);
497 }
498
499 /* .driver_data stores max mtu */
500 static const struct mhi_device_id mhi_wwan_ctrl_match_table[] = {
501 { .chan = MHI_WWAN_CTRL_PROTO_AT, .driver_data = 4096 },
502 { .chan = MHI_WWAN_CTRL_PROTO_MBIM, .driver_data = 4096 },
503 { .chan = MHI_WWAN_CTRL_PROTO_QMUX, .driver_data = 4096 },
> 504 { .chan = MHI_WWAN_CTRL_PROTO_QCDM, .driver_data = MHI_MAX_MTU },
505 { .chan = MHI_WWAN_CTRL_PROTO_FIREHOSE, .driver_data = MHI_MAX_MTU },
506 {},
507 };
508 MODULE_DEVICE_TABLE(mhi, mhi_wwan_ctrl_match_table);
509

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 59728 bytes --]