Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6301002f authored by Jesse Brandeburg's avatar Jesse Brandeburg Committed by Jeff Kirsher
Browse files

i40e: debugfs fixups



debugfs fixes for issues found by coverity.

This issue was identified by the coverity checker, reported by Hannes Frederic
Sowa.

Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
CC: Hannes Frederic Sowa <hannes@stressinduktion.org>
Tested-by: default avatarKavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 958a3e3b
Loading
Loading
Loading
Loading
+26 −12
Original line number Diff line number Diff line
@@ -2019,21 +2019,35 @@ static const struct file_operations i40e_dbg_netdev_ops_fops = {
 **/
void i40e_dbg_pf_init(struct i40e_pf *pf)
{
	struct dentry *pfile __attribute__((unused));
	struct dentry *pfile;
	const char *name = pci_name(pf->pdev);
	const struct device *dev = &pf->pdev->dev;

	pf->i40e_dbg_pf = debugfs_create_dir(name, i40e_dbg_root);
	if (pf->i40e_dbg_pf) {
		pfile = debugfs_create_file("command", 0600, pf->i40e_dbg_pf,
					    pf, &i40e_dbg_command_fops);
	if (!pf->i40e_dbg_pf)
		return;

	pfile = debugfs_create_file("command", 0600, pf->i40e_dbg_pf, pf,
				    &i40e_dbg_command_fops);
	if (!pfile)
		goto create_failed;

	pfile = debugfs_create_file("dump", 0600, pf->i40e_dbg_pf, pf,
				    &i40e_dbg_dump_fops);
		pfile = debugfs_create_file("netdev_ops", 0600, pf->i40e_dbg_pf,
					    pf, &i40e_dbg_netdev_ops_fops);
	} else {
		dev_info(&pf->pdev->dev,
			 "debugfs entry for %s failed\n", name);
	}
	if (!pfile)
		goto create_failed;

	pfile = debugfs_create_file("netdev_ops", 0600, pf->i40e_dbg_pf, pf,
				    &i40e_dbg_netdev_ops_fops);
	if (!pfile)
		goto create_failed;

	return;

create_failed:
	dev_info(dev, "debugfs dir/file for %s failed\n", name);
	debugfs_remove_recursive(pf->i40e_dbg_pf);
	return;
}

/**