[PATCH v2 4/5] driver core: Add device probe log helper dev_warn_probe()
kernel test robot
lkp at intel.com
Sat Sep 28 18:39:08 PDT 2024
Hi Dragan,
kernel test robot noticed the following build warnings:
[auto build test WARNING on rockchip/for-next]
[also build test WARNING on broonie-spi/for-next driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus linus/master v6.11 next-20240927]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Dragan-Simic/spi-rockchip-Perform-trivial-code-cleanups/20240928-121548
base: https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next
patch link: https://lore.kernel.org/r/2fd9a60e0efe906dc7a203cd652c8d0b7f932470.1727496560.git.dsimic%40manjaro.org
patch subject: [PATCH v2 4/5] driver core: Add device probe log helper dev_warn_probe()
config: openrisc-allnoconfig (https://download.01.org/0day-ci/archive/20240929/202409290956.jwLrcN1S-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240929/202409290956.jwLrcN1S-lkp@intel.com/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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409290956.jwLrcN1S-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/base/core.c: In function 'dev_err_probe':
>> drivers/base/core.c:5055:1: warning: control reaches end of non-void function [-Wreturn-type]
5055 | }
| ^
drivers/base/core.c: In function 'dev_warn_probe':
drivers/base/core.c:5101:1: warning: control reaches end of non-void function [-Wreturn-type]
5101 | }
| ^
vim +5055 drivers/base/core.c
5011
5012 /**
5013 * dev_err_probe - probe error check and log helper
5014 * @dev: the pointer to the struct device
5015 * @err: error value to test
5016 * @fmt: printf-style format string
5017 * @...: arguments as specified in the format string
5018 *
5019 * This helper implements common pattern present in probe functions for error
5020 * checking: print debug or error message depending if the error value is
5021 * -EPROBE_DEFER and propagate error upwards.
5022 * In case of -EPROBE_DEFER it sets also defer probe reason, which can be
5023 * checked later by reading devices_deferred debugfs attribute.
5024 * It replaces the following code sequence::
5025 *
5026 * if (err != -EPROBE_DEFER)
5027 * dev_err(dev, ...);
5028 * else
5029 * dev_dbg(dev, ...);
5030 * return err;
5031 *
5032 * with::
5033 *
5034 * return dev_err_probe(dev, err, ...);
5035 *
5036 * Using this helper in your probe function is totally fine even if @err
5037 * is known to never be -EPROBE_DEFER.
5038 * The benefit compared to a normal dev_err() is the standardized format
5039 * of the error code, which is emitted symbolically (i.e. you get "EAGAIN"
5040 * instead of "-35"), and having the error code returned allows more
5041 * compact error paths.
5042 *
5043 * Returns @err.
5044 */
5045 int dev_err_probe(const struct device *dev, int err, const char *fmt, ...)
5046 {
5047 va_list args;
5048
5049 va_start(args, fmt);
5050
5051 /* Use dev_err() for logging when err doesn't equal -EPROBE_DEFER */
5052 dev_probe_failed(dev, err, true, fmt, args);
5053
5054 va_end(args);
> 5055 }
5056 EXPORT_SYMBOL_GPL(dev_err_probe);
5057
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the Linux-rockchip
mailing list