* [Intel-wired-lan] [PATCH] net-i40e: Replace variable initialisations by assignments in i40e_vc_get_vf_resources_msg()
[not found] <566ABCD9.1060404@users.sourceforge.net>
@ 2016-01-01 14:32 ` SF Markus Elfring
2016-01-01 14:51 ` [Intel-wired-lan] net-i40e: Reconsider further usage of variable "i" " SF Markus Elfring
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: SF Markus Elfring @ 2016-01-01 14:32 UTC (permalink / raw)
To: intel-wired-lan
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 1 Jan 2016 15:11:09 +0100
Replace explicit initialisations for four local variables at the beginning
by assignments that will only be performed if the corresponding code
will really be executed.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index aa58a49..e0874f5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -1172,16 +1172,18 @@ static int i40e_vc_get_version_msg(struct i40e_vf *vf, u8 *msg)
**/
static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
{
- struct i40e_virtchnl_vf_resource *vfres = NULL;
- struct i40e_pf *pf = vf->pf;
- i40e_status aq_ret = 0;
+ struct i40e_virtchnl_vf_resource *vfres;
+ struct i40e_pf *pf;
+ i40e_status aq_ret;
struct i40e_vsi *vsi;
- int i = 0, len = 0;
+ int i = 0;
int num_vsis = 1;
- int ret;
+ int len, ret;
if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) {
aq_ret = I40E_ERR_PARAM;
+ vfres = NULL;
+ len = 0;
goto err;
}
@@ -1202,6 +1204,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
I40E_VIRTCHNL_VF_OFFLOAD_VLAN;
vfres->vf_offload_flags = I40E_VIRTCHNL_VF_OFFLOAD_L2;
+ pf = vf->pf;
vsi = pf->vsi[vf->lan_vsi_idx];
if (!vsi->info.pvid)
vfres->vf_offload_flags |= I40E_VIRTCHNL_VF_OFFLOAD_VLAN;
@@ -1231,7 +1234,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
i++;
}
set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states);
-
+ aq_ret = 0;
err:
/* send the response back to the VF */
ret = i40e_vc_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_VF_RESOURCES,
--
2.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Intel-wired-lan] net-i40e: Reconsider further usage of variable "i" in i40e_vc_get_vf_resources_msg()
2016-01-01 14:32 ` [Intel-wired-lan] [PATCH] net-i40e: Replace variable initialisations by assignments in i40e_vc_get_vf_resources_msg() SF Markus Elfring
@ 2016-01-01 14:51 ` SF Markus Elfring
2016-01-08 20:51 ` Nelson, Shannon
2016-01-07 22:43 ` [Intel-wired-lan] [PATCH] net-i40e: Replace variable initialisations by assignments " Nelson, Shannon
2016-01-08 10:42 ` Jeff Kirsher
2 siblings, 1 reply; 5+ messages in thread
From: SF Markus Elfring @ 2016-01-01 14:51 UTC (permalink / raw)
To: intel-wired-lan
Hello,
I have taken another look at the implementation of the
function "i40e_vc_get_vf_resources_msg". I find the use of the variable "i"
strange there. It seems that the value from the increment operation in an
if branch is not reused so far.
I would appreciate a further clarification.
Can this variable be eventually deleted?
Regards,
Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Intel-wired-lan] [PATCH] net-i40e: Replace variable initialisations by assignments in i40e_vc_get_vf_resources_msg()
2016-01-01 14:32 ` [Intel-wired-lan] [PATCH] net-i40e: Replace variable initialisations by assignments in i40e_vc_get_vf_resources_msg() SF Markus Elfring
2016-01-01 14:51 ` [Intel-wired-lan] net-i40e: Reconsider further usage of variable "i" " SF Markus Elfring
@ 2016-01-07 22:43 ` Nelson, Shannon
2016-01-08 10:42 ` Jeff Kirsher
2 siblings, 0 replies; 5+ messages in thread
From: Nelson, Shannon @ 2016-01-07 22:43 UTC (permalink / raw)
To: intel-wired-lan
> From: SF Markus Elfring [mailto:elfring at users.sourceforge.net]
> Sent: Friday, January 01, 2016 6:33 AM
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 1 Jan 2016 15:11:09 +0100
>
> Replace explicit initialisations for four local variables at the beginning
> by assignments that will only be performed if the corresponding code
> will really be executed.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
This seems to me to be unnecessary fussing with the code.
sln
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Intel-wired-lan] [PATCH] net-i40e: Replace variable initialisations by assignments in i40e_vc_get_vf_resources_msg()
2016-01-01 14:32 ` [Intel-wired-lan] [PATCH] net-i40e: Replace variable initialisations by assignments in i40e_vc_get_vf_resources_msg() SF Markus Elfring
2016-01-01 14:51 ` [Intel-wired-lan] net-i40e: Reconsider further usage of variable "i" " SF Markus Elfring
2016-01-07 22:43 ` [Intel-wired-lan] [PATCH] net-i40e: Replace variable initialisations by assignments " Nelson, Shannon
@ 2016-01-08 10:42 ` Jeff Kirsher
2 siblings, 0 replies; 5+ messages in thread
From: Jeff Kirsher @ 2016-01-08 10:42 UTC (permalink / raw)
To: intel-wired-lan
On Fri, 2016-01-01 at 15:32 +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 1 Jan 2016 15:11:09 +0100
>
> Replace explicit initialisations for four local variables at the
> beginning
> by assignments that will only be performed if the corresponding code
> will really be executed.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> ?drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 15 +++++++++---
> ---
> ?1 file changed, 9 insertions(+), 6 deletions(-)
Dropping this patch based on feedback from Shannon.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20160108/d5613803/attachment.asc>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Intel-wired-lan] net-i40e: Reconsider further usage of variable "i" in i40e_vc_get_vf_resources_msg()
2016-01-01 14:51 ` [Intel-wired-lan] net-i40e: Reconsider further usage of variable "i" " SF Markus Elfring
@ 2016-01-08 20:51 ` Nelson, Shannon
0 siblings, 0 replies; 5+ messages in thread
From: Nelson, Shannon @ 2016-01-08 20:51 UTC (permalink / raw)
To: intel-wired-lan
> From: SF Markus Elfring [mailto:elfring at users.sourceforge.net]
>
> Hello,
>
> I have taken another look at the implementation of the
> function "i40e_vc_get_vf_resources_msg". I find the use of the variable
> "i"
> strange there. It seems that the value from the increment operation in
> an
> if branch is not reused so far.
>
> I would appreciate a further clarification.
> Can this variable be eventually deleted?
Thanks for pointing this out. We've got an internal patch coming that will address this.
Cheers,
sln
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-01-08 20:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <566ABCD9.1060404@users.sourceforge.net>
2016-01-01 14:32 ` [Intel-wired-lan] [PATCH] net-i40e: Replace variable initialisations by assignments in i40e_vc_get_vf_resources_msg() SF Markus Elfring
2016-01-01 14:51 ` [Intel-wired-lan] net-i40e: Reconsider further usage of variable "i" " SF Markus Elfring
2016-01-08 20:51 ` Nelson, Shannon
2016-01-07 22:43 ` [Intel-wired-lan] [PATCH] net-i40e: Replace variable initialisations by assignments " Nelson, Shannon
2016-01-08 10:42 ` Jeff Kirsher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox