[linux-next:master 8437/9113] lib/kunit/device.c:68: warning: Function parameter or struct member 'test' not described in 'kunit_driver_create'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ceb2fe0d438644e1de06b9a6468a1fb8e2199c70
commit: dcb420cba3162bce885a2127865888850a6d6b99 [8437/9113] kunit: Add APIs for managing devices
config: x86_64-buildonly-randconfig-003-20231218 (https://download.01.org/0day-ci/archive/20231218/202312181920.H4EPAH20-lkp@xxxxxxxxx/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231218/202312181920.H4EPAH20-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312181920.H4EPAH20-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> lib/kunit/device.c:68: warning: Function parameter or struct member 'test' not described in 'kunit_driver_create'
>> lib/kunit/device.c:68: warning: Function parameter or struct member 'name' not described in 'kunit_driver_create'
   lib/kunit/device.c:68: warning: expecting prototype for Create and register a KUnit(). Prototype was for kunit_driver_create() instead
>> lib/kunit/device.c:134: warning: Function parameter or struct member 'test' not described in 'kunit_device_register_with_driver'
>> lib/kunit/device.c:134: warning: Function parameter or struct member 'name' not described in 'kunit_device_register_with_driver'
>> lib/kunit/device.c:134: warning: Function parameter or struct member 'drv' not described in 'kunit_device_register_with_driver'
   lib/kunit/device.c:134: warning: expecting prototype for Create and register a new KUnit-managed device, using the user(). Prototype was for kunit_device_register_with_driver() instead
>> lib/kunit/device.c:149: warning: Function parameter or struct member 'test' not described in 'kunit_device_register'
>> lib/kunit/device.c:149: warning: Function parameter or struct member 'name' not described in 'kunit_device_register'
   lib/kunit/device.c:149: warning: expecting prototype for Create and register a new KUnit(). Prototype was for kunit_device_register() instead


vim +68 lib/kunit/device.c

    62	
    63	/**
    64	 * Create and register a KUnit-managed struct device_driver on the kunit_bus.
    65	 * Returns an error pointer on failure.
    66	 */
    67	struct device_driver *kunit_driver_create(struct kunit *test, const char *name)
  > 68	{
    69		struct device_driver *driver;
    70		int err = -ENOMEM;
    71	
    72		driver = kunit_kzalloc(test, sizeof(*driver), GFP_KERNEL);
    73	
    74		if (!driver)
    75			return ERR_PTR(err);
    76	
    77		driver->name = name;
    78		driver->bus = &kunit_bus_type;
    79		driver->owner = THIS_MODULE;
    80	
    81		err = driver_register(driver);
    82		if (err) {
    83			kunit_kfree(test, driver);
    84			return ERR_PTR(err);
    85		}
    86	
    87		kunit_add_action(test, driver_unregister_wrapper, driver);
    88		return driver;
    89	}
    90	EXPORT_SYMBOL_GPL(kunit_driver_create);
    91	
    92	/* Helper which creates a kunit_device, attaches it to the kunit_bus*/
    93	static struct kunit_device *kunit_device_register_internal(struct kunit *test,
    94								   const char *name,
    95								   const struct device_driver *drv)
    96	{
    97		struct kunit_device *kunit_dev;
    98		int err = -ENOMEM;
    99	
   100		kunit_dev = kzalloc(sizeof(*kunit_dev), GFP_KERNEL);
   101		if (!kunit_dev)
   102			return ERR_PTR(err);
   103	
   104		kunit_dev->owner = test;
   105	
   106		err = dev_set_name(&kunit_dev->dev, "%s.%s", test->name, name);
   107		if (err) {
   108			kfree(kunit_dev);
   109			return ERR_PTR(err);
   110		}
   111	
   112		kunit_dev->dev.release = kunit_device_release;
   113		kunit_dev->dev.bus = &kunit_bus_type;
   114		kunit_dev->dev.parent = kunit_bus_device;
   115	
   116		err = device_register(&kunit_dev->dev);
   117		if (err) {
   118			put_device(&kunit_dev->dev);
   119			return ERR_PTR(err);
   120		}
   121	
   122		kunit_add_action(test, device_unregister_wrapper, &kunit_dev->dev);
   123	
   124		return kunit_dev;
   125	}
   126	
   127	/**
   128	 * Create and register a new KUnit-managed device, using the user-supplied device_driver.
   129	 * On failure, returns an error pointer.
   130	 */
   131	struct device *kunit_device_register_with_driver(struct kunit *test,
   132							 const char *name,
   133							 const struct device_driver *drv)
 > 134	{
   135		struct kunit_device *kunit_dev = kunit_device_register_internal(test, name, drv);
   136	
   137		if (IS_ERR_OR_NULL(kunit_dev))
   138			return ERR_CAST(kunit_dev);
   139	
   140		return &kunit_dev->dev;
   141	}
   142	EXPORT_SYMBOL_GPL(kunit_device_register_with_driver);
   143	
   144	/**
   145	 * Create and register a new KUnit-managed device, including a matching device_driver.
   146	 * On failure, returns an error pointer.
   147	 */
   148	struct device *kunit_device_register(struct kunit *test, const char *name)
 > 149	{
   150		struct device_driver *drv;
   151		struct kunit_device *dev;
   152	
   153		drv = kunit_driver_create(test, name);
   154		if (IS_ERR(drv))
   155			return ERR_CAST(drv);
   156	
   157		dev = kunit_device_register_internal(test, name, drv);
   158		if (IS_ERR(dev)) {
   159			kunit_release_action(test, driver_unregister_wrapper, (void *)drv);
   160			return ERR_CAST(dev);
   161		}
   162	
   163		/* Request the driver be freed. */
   164		dev->driver = drv;
   165	
   166	
   167		return &dev->dev;
   168	}
   169	EXPORT_SYMBOL_GPL(kunit_device_register);
   170	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux