All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/soc/tegra/cbb/tegra-cbb.c:96 tegra_cbb_err_debugfs_init() warn: passing zero to 'PTR_ERR'
@ 2023-04-20  9:24 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2023-04-20  9:24 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Sumit Gupta <sumitg@nvidia.com>
CC: Thierry Reding <treding@nvidia.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   cb0856346a60fe3eb837ba5e73588a41f81ac05f
commit: b7134422146692e096e807751656fc58ee1a717d soc/tegra: cbb: Add CBB 1.0 driver for Tegra194
date:   7 months ago
:::::: branch date: 8 hours ago
:::::: commit date: 7 months ago
config: arm64-randconfig-m041-20230419 (https://download.01.org/0day-ci/archive/20230420/202304201719.AnFYgA2p-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Link: https://lore.kernel.org/r/202304201719.AnFYgA2p-lkp@intel.com/

smatch warnings:
drivers/soc/tegra/cbb/tegra-cbb.c:96 tegra_cbb_err_debugfs_init() warn: passing zero to 'PTR_ERR'

vim +/PTR_ERR +96 drivers/soc/tegra/cbb/tegra-cbb.c

b7134422146692 Sumit Gupta 2022-05-12   87  
b7134422146692 Sumit Gupta 2022-05-12   88  static int tegra_cbb_err_debugfs_init(struct tegra_cbb *cbb)
b7134422146692 Sumit Gupta 2022-05-12   89  {
b7134422146692 Sumit Gupta 2022-05-12   90  	static struct dentry *root;
b7134422146692 Sumit Gupta 2022-05-12   91  
b7134422146692 Sumit Gupta 2022-05-12   92  	if (!root) {
b7134422146692 Sumit Gupta 2022-05-12   93  		root = debugfs_create_file("tegra_cbb_err", 0444, NULL, cbb, &tegra_cbb_err_fops);
b7134422146692 Sumit Gupta 2022-05-12   94  		if (IS_ERR_OR_NULL(root)) {
b7134422146692 Sumit Gupta 2022-05-12   95  			pr_err("%s(): could not create debugfs node\n", __func__);
b7134422146692 Sumit Gupta 2022-05-12  @96  			return PTR_ERR(root);
b7134422146692 Sumit Gupta 2022-05-12   97  		}
b7134422146692 Sumit Gupta 2022-05-12   98  	}
b7134422146692 Sumit Gupta 2022-05-12   99  
b7134422146692 Sumit Gupta 2022-05-12  100  	return 0;
b7134422146692 Sumit Gupta 2022-05-12  101  }
b7134422146692 Sumit Gupta 2022-05-12  102  

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* drivers/soc/tegra/cbb/tegra-cbb.c:96 tegra_cbb_err_debugfs_init() warn: passing zero to 'PTR_ERR'
@ 2023-04-20 10:18 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2023-04-20 10:18 UTC (permalink / raw)
  To: oe-kbuild, Sumit Gupta; +Cc: lkp, oe-kbuild-all, linux-kernel, Thierry Reding

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   cb0856346a60fe3eb837ba5e73588a41f81ac05f
commit: b7134422146692e096e807751656fc58ee1a717d soc/tegra: cbb: Add CBB 1.0 driver for Tegra194
config: arm64-randconfig-m041-20230419 (https://download.01.org/0day-ci/archive/20230420/202304201719.AnFYgA2p-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Link: https://lore.kernel.org/r/202304201719.AnFYgA2p-lkp@intel.com/

smatch warnings:
drivers/soc/tegra/cbb/tegra-cbb.c:96 tegra_cbb_err_debugfs_init() warn: passing zero to 'PTR_ERR'

vim +/PTR_ERR +96 drivers/soc/tegra/cbb/tegra-cbb.c

b7134422146692 Sumit Gupta 2022-05-12   88  static int tegra_cbb_err_debugfs_init(struct tegra_cbb *cbb)
b7134422146692 Sumit Gupta 2022-05-12   89  {
b7134422146692 Sumit Gupta 2022-05-12   90  	static struct dentry *root;
b7134422146692 Sumit Gupta 2022-05-12   91  
b7134422146692 Sumit Gupta 2022-05-12   92  	if (!root) {
b7134422146692 Sumit Gupta 2022-05-12   93  		root = debugfs_create_file("tegra_cbb_err", 0444, NULL, cbb, &tegra_cbb_err_fops);
b7134422146692 Sumit Gupta 2022-05-12   94  		if (IS_ERR_OR_NULL(root)) {
b7134422146692 Sumit Gupta 2022-05-12   95  			pr_err("%s(): could not create debugfs node\n", __func__);
b7134422146692 Sumit Gupta 2022-05-12  @96  			return PTR_ERR(root);
b7134422146692 Sumit Gupta 2022-05-12   97  		}
b7134422146692 Sumit Gupta 2022-05-12   98  	}
b7134422146692 Sumit Gupta 2022-05-12   99  
b7134422146692 Sumit Gupta 2022-05-12  100  	return 0;

Debugfs stopped returning NULL years ago.  Debugfs is weird, it's not
supposed to be checked for errors.  So the correct way to write this
is:

static void tegra_cbb_err_debugfs_init(struct tegra_cbb *cbb)
{
	static struct dentry *root;

	if (!root)
		root = debugfs_create_file("tegra_cbb_err", 0444, NULL, cbb, &tegra_cbb_err_fops);
}

regards,
dan carpenter

b7134422146692 Sumit Gupta 2022-05-12  101  }

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-20 10:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-20  9:24 drivers/soc/tegra/cbb/tegra-cbb.c:96 tegra_cbb_err_debugfs_init() warn: passing zero to 'PTR_ERR' kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2023-04-20 10:18 Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.