Skip to contentSkip to conversation

xilinx:Remove unused variable num_frag in the function axienet_start_xmit

PATCH In review Nicholas Krause 2 participants 5 messages Jun 17, 2015 – Jun 18, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xilinx:Remove unused variable num_frag in the function axienet_start_xmit

This removes the unused variable num_frag and the setting of it to the number of fragments from the passed sk_buff pointer by this function's caller due to this variable never being used in this particular function and is not declared as global so setting it for global use in this file is pointless.

---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -2
index 28b7e7d..624dce4 100644
@@ -651,7 +651,6 @@ static inline int axienet_check_tx_bd_space(struct axienet_local *lp,
 static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 {
 	u32 ii;
-	u32 num_frag;
 	u32 csum_start_off;
 	u32 csum_index_off;
 	skb_frag_t *frag;
@@ -659,7 +658,6 @@ static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	struct axienet_local *lp = netdev_priv(ndev);
 	struct axidma_bd *cur_p;
 
-	num_frag = skb_shinfo(skb)->nr_frags;
 	cur_p = &lp->tx_bd_v[lp->tx_bd_tail];
 
 	if (axienet_check_tx_bd_space(lp, num_frag)) {
Signature · 1 line
2.1.4
#1 lore raw
Quoted 24 lines · Nicholas Krause

This removes the unused variable num_frag and the setting of it to the number of fragments from the passed sk_buff pointer by this function's caller due to this variable never being used in this particular function and is not declared as global so setting it for global use in this file is pointless.

---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -1
index 28b7e7d..624dce4 100644
@@ -651,7 +651,6 @@ static inline int axienet_check_tx_bd_space(struct axienet_local *lp,
 static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 {
 	u32 ii;
-	u32 num_frag;
 	u32 csum_start_off;
 	u32 csum_index_off;
 	skb_frag_t *frag;

drivers/net/ethernet/xilinx/xilinx_axienet_main.c static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) · line 663

Quoted 7 lines
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -1
@@ -659,7 +658,6 @@ static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	struct axienet_local *lp = netdev_priv(ndev);
 	struct axidma_bd *cur_p;
 
-	num_frag = skb_shinfo(skb)->nr_frags;
 	cur_p = &lp->tx_bd_v[lp->tx_bd_tail];
 
 	if (axienet_check_tx_bd_space(lp, num_frag)) {

It's used right here, isn't it (and further down in this function too)? Does your tree compile with this change?

S?ren

#2 lore raw
Quoted 35 lines · S?ren Brinkmann
Quoted 6 lines · Nicholas Krause

This removes the unused variable num_frag and the setting of it to the number of fragments from the passed sk_buff pointer by this function's caller due to this variable never being used in this particular function and is not declared as global so setting it for global use in this file is pointless.

Review

Quoted 6 lines
---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 --
 1 file changed, 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c

drivers/net/ethernet/xilinx/xilinx_axienet_main.c static inline int

Quoted 4 lines

index 28b7e7d..624dce4 100644

drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -0
@@ -651,7 +651,6 @@ static inline int

axienet_check_tx_bd_space(struct axienet_local *lp,

drivers/net/ethernet/xilinx/xilinx_axienet_main.c static inline int · line 651

Quoted 1 line
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -0
 static int axienet_start_xmit(struct sk_buff *skb, struct net_device

*ndev)

drivers/net/ethernet/xilinx/xilinx_axienet_main.c static int axienet_start_xmit(struct sk_buff

Quoted 7 lines
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -1
 {
 	u32 ii;
-	u32 num_frag;
 	u32 csum_start_off;
 	u32 csum_index_off;
 	skb_frag_t *frag;
@@ -659,7 +658,6 @@ static int axienet_start_xmit(struct sk_buff

*skb, struct net_device *ndev)

Quoted 6 lines
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -1
 	struct axienet_local *lp = netdev_priv(ndev);
 	struct axidma_bd *cur_p;
 
-	num_frag = skb_shinfo(skb)->nr_frags;
 	cur_p = &lp->tx_bd_v[lp->tx_bd_tail];
 
Quoted 6 lines

drivers/net/ethernet/xilinx/xilinx_axienet_main.c static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) · line 663

Quoted 1 line
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -0
 	if (axienet_check_tx_bd_space(lp, num_frag)) {

It's used right here, isn't it (and further down in this function too)? Does your tree compile with this change?

S?ren

My tree does compile with this change.
Nick

Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
#3 lore raw
Quoted 38 lines · Nicholas Krause
Quoted 35 lines · S?ren Brinkmann
Quoted 6 lines · Nicholas Krause

This removes the unused variable num_frag and the setting of it to the number of fragments from the passed sk_buff pointer by this function's caller due to this variable never being used in this particular function and is not declared as global so setting it for global use in this file is pointless.

Review

Quoted 6 lines
---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 --
 1 file changed, 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c

drivers/net/ethernet/xilinx/xilinx_axienet_main.c static inline int

Quoted 4 lines

index 28b7e7d..624dce4 100644

drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -0
@@ -651,7 +651,6 @@ static inline int

axienet_check_tx_bd_space(struct axienet_local *lp,

drivers/net/ethernet/xilinx/xilinx_axienet_main.c static inline int · line 651

Quoted 1 line
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -0
 static int axienet_start_xmit(struct sk_buff *skb, struct net_device

*ndev)

drivers/net/ethernet/xilinx/xilinx_axienet_main.c static int axienet_start_xmit(struct sk_buff

Quoted 7 lines
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -1
 {
 	u32 ii;
-	u32 num_frag;
 	u32 csum_start_off;
 	u32 csum_index_off;
 	skb_frag_t *frag;
@@ -659,7 +658,6 @@ static int axienet_start_xmit(struct sk_buff

*skb, struct net_device *ndev)

Quoted 6 lines
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -1
 	struct axienet_local *lp = netdev_priv(ndev);
 	struct axidma_bd *cur_p;
 
-	num_frag = skb_shinfo(skb)->nr_frags;
 	cur_p = &lp->tx_bd_v[lp->tx_bd_tail];
 
Quoted 7 lines
Quoted 6 lines

drivers/net/ethernet/xilinx/xilinx_axienet_main.c static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) · line 663

Quoted 1 line
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -0
 	if (axienet_check_tx_bd_space(lp, num_frag)) {

It's used right here, isn't it (and further down in this function too)? Does your tree compile with this change?

S?ren

My tree does compile with this change.

You have to fix your testing process:

    CHK     include/config/kernel.release
    UPD     include/config/kernel.release
    CHK     include/generated/uapi/linux/version.h
    CHK     include/generated/utsrelease.h
    UPD     include/generated/utsrelease.h
    CHK     include/generated/bounds.h
    CHK     include/generated/timeconst.h
    CHK     include/generated/asm-offsets.h
    CALL    scripts/checksyscalls.sh
  <stdin>:1253:2: warning: #warning syscall userfaultfd not implemented [-Wcpp]
    CC      drivers/net/ethernet/xilinx/xilinx_axienet_main.o
  drivers/net/ethernet/xilinx/xilinx_axienet_main.c: In function 'axienet_start_xmit':
  drivers/net/ethernet/xilinx/xilinx_axienet_main.c:667:36: error: 'num_frag' undeclared (first use in this function)
    if (axienet_check_tx_bd_space(lp, num_frag)) {
                                      ^

drivers/net/ethernet/xilinx/xilinx_axienet_main.c:667:36: note: each undeclared identifier is reported only once for each function it appears in scripts/Makefile.build:258: recipe for target 'drivers/net/ethernet/xilinx/xilinx_axienet_main.o' failed
make[1]: *** [drivers/net/ethernet/xilinx/xilinx_axienet_main.o] Error 1
Makefile:1545: recipe for target 'drivers/net/ethernet/xilinx/xilinx_axienet_main.o' failed
make: *** [drivers/net/ethernet/xilinx/xilinx_axienet_main.o] Error 2

NACK for the patch.

S?ren

author
#4 lore raw
Quoted 69 lines · S?ren Brinkmann
Quoted 38 lines · Nicholas Krause
Quoted 35 lines · S?ren Brinkmann
Quoted 6 lines · Nicholas Krause

This removes the unused variable num_frag and the setting of it to the number of fragments from the passed sk_buff pointer by this function's caller due to this variable never being used in this particular function and is not declared as global so setting it for global use in this file is pointless.

Review

Quoted 6 lines
---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 --
 1 file changed, 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c

drivers/net/ethernet/xilinx/xilinx_axienet_main.c static inline int

Quoted 4 lines

index 28b7e7d..624dce4 100644

drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -0
@@ -651,7 +651,6 @@ static inline int

axienet_check_tx_bd_space(struct axienet_local *lp,

drivers/net/ethernet/xilinx/xilinx_axienet_main.c static inline int · line 651

Quoted 1 line
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -0
 static int axienet_start_xmit(struct sk_buff *skb, struct net_device

*ndev)

drivers/net/ethernet/xilinx/xilinx_axienet_main.c static int axienet_start_xmit(struct sk_buff

Quoted 7 lines
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -1
 {
 	u32 ii;
-	u32 num_frag;
 	u32 csum_start_off;
 	u32 csum_index_off;
 	skb_frag_t *frag;
@@ -659,7 +658,6 @@ static int axienet_start_xmit(struct sk_buff

*skb, struct net_device *ndev)

Quoted 6 lines
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -1
 	struct axienet_local *lp = netdev_priv(ndev);
 	struct axidma_bd *cur_p;
 
-	num_frag = skb_shinfo(skb)->nr_frags;
 	cur_p = &lp->tx_bd_v[lp->tx_bd_tail];
 
Quoted 7 lines
Quoted 6 lines

drivers/net/ethernet/xilinx/xilinx_axienet_main.c static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) · line 663

Quoted 1 line
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0 -0
 	if (axienet_check_tx_bd_space(lp, num_frag)) {

It's used right here, isn't it (and further down in this function too)? Does your tree compile with this change?

S?ren

My tree does compile with this change.

You have to fix your testing process:

    CHK     include/config/kernel.release
    UPD     include/config/kernel.release
    CHK     include/generated/uapi/linux/version.h
    CHK     include/generated/utsrelease.h
    UPD     include/generated/utsrelease.h
    CHK     include/generated/bounds.h
    CHK     include/generated/timeconst.h
    CHK     include/generated/asm-offsets.h
    CALL    scripts/checksyscalls.sh
  <stdin>:1253:2: warning: #warning syscall userfaultfd not implemented [-Wcpp]
    CC      drivers/net/ethernet/xilinx/xilinx_axienet_main.o
  drivers/net/ethernet/xilinx/xilinx_axienet_main.c: In function 'axienet_start_xmit':
  drivers/net/ethernet/xilinx/xilinx_axienet_main.c:667:36: error: 'num_frag' undeclared (first use in this function)
    if (axienet_check_tx_bd_space(lp, num_frag)) {
                                      ^

drivers/net/ethernet/xilinx/xilinx_axienet_main.c:667:36: note: each undeclared identifier is reported only once for each function it appears in scripts/Makefile.build:258: recipe for target 'drivers/net/ethernet/xilinx/xilinx_axienet_main.o' failed
make[1]: *** [drivers/net/ethernet/xilinx/xilinx_axienet_main.o] Error 1
Makefile:1545: recipe for target 'drivers/net/ethernet/xilinx/xilinx_axienet_main.o' failed
make: *** [drivers/net/ethernet/xilinx/xilinx_axienet_main.o] Error 2

Quoted 4 lines

NACK for the patch.

S?ren

Sorry about that as I tried again and it didn't build. Weird issue maybe something with ccache. Nick