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

Commit 3b195843 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller
Browse files

i40e: Fix i40e_print_features() VEB mode output



Commit 7fd89545 ("i40e: remove BUG_ON from feature string building")
added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
function i40e_print_features.

Fix it.

Miscellanea:

- Remove unnecessary string variable
- Add space before not after fixed strings
- Use kmalloc not kzalloc
- Don't initialize i to 0, use result of first snprintf

Reported-by: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 68e14a48
Loading
Loading
Loading
Loading
+19 −23
Original line number Diff line number Diff line
@@ -10290,18 +10290,14 @@ static int i40e_setup_pf_filter_control(struct i40e_pf *pf)
static void i40e_print_features(struct i40e_pf *pf)
{
	struct i40e_hw *hw = &pf->hw;
	char *buf, *string;
	int i = 0;
	char *buf;
	int i;

	string = kzalloc(INFO_STRING_LEN, GFP_KERNEL);
	if (!string) {
		dev_err(&pf->pdev->dev, "Features string allocation failed\n");
	buf = kmalloc(INFO_STRING_LEN, GFP_KERNEL);
	if (!buf)
		return;
	}

	buf = string;

	i += snprintf(&buf[i], REMAIN(i), "Features: PF-id[%d] ", hw->pf_id);
	i = snprintf(buf, INFO_STRING_LEN, "Features: PF-id[%d]", hw->pf_id);
#ifdef CONFIG_PCI_IOV
	i += snprintf(&buf[i], REMAIN(i), " VFs: %d", pf->num_req_vfs);
#endif
@@ -10330,12 +10326,12 @@ static void i40e_print_features(struct i40e_pf *pf)
		i += snprintf(&buf[i], REMAIN(i), " FCOE");
#endif
	if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
		i += snprintf(&buf[i], REMAIN(i), "VEPA ");
		i += snprintf(&buf[i], REMAIN(i), " VEB");
	else
		buf += sprintf(buf, "VEPA ");
		i += snprintf(&buf[i], REMAIN(i), " VEPA");

	dev_info(&pf->pdev->dev, "%s\n", string);
	kfree(string);
	dev_info(&pf->pdev->dev, "%s\n", buf);
	kfree(buf);
	WARN_ON(i > INFO_STRING_LEN);
}