All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/net/rocker/rocker_of_dpa.c: Remove superfluous error check
@ 2024-11-12  1:26 Rodrigo Dias Correa
  2024-11-13 10:32 ` Ján Tomko
  0 siblings, 1 reply; 2+ messages in thread
From: Rodrigo Dias Correa @ 2024-11-12  1:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: jiri, jasowang

of_dpa_cmd_add_acl_ip() is called from a single place, and despite the
fact that it always returns ROCKER_OK, its return value is still checked
by the caller.
Change of_dpa_cmd_add_acl_ip() to return void and remove the superfluous
check from of_dpa_cmd_add_acl().
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2471

Signed-off-by: Rodrigo Dias Correa <r@drigo.nl>
---
 hw/net/rocker/rocker_of_dpa.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/hw/net/rocker/rocker_of_dpa.c b/hw/net/rocker/rocker_of_dpa.c
index 5e16056be6..6d29130ec2 100644
--- a/hw/net/rocker/rocker_of_dpa.c
+++ b/hw/net/rocker/rocker_of_dpa.c
@@ -1635,7 +1635,7 @@ static int of_dpa_cmd_add_multicast_routing(OfDpaFlow *flow,
     return ROCKER_OK;
 }
 
-static int of_dpa_cmd_add_acl_ip(OfDpaFlowKey *key, OfDpaFlowKey *mask,
+static void of_dpa_cmd_add_acl_ip(OfDpaFlowKey *key, OfDpaFlowKey *mask,
                                  RockerTlv **flow_tlvs)
 {
     key->width = FLOW_KEY_WIDTH(ip.tos);
@@ -1669,8 +1669,6 @@ static int of_dpa_cmd_add_acl_ip(OfDpaFlowKey *key, OfDpaFlowKey *mask,
         mask->ip.tos |=
             rocker_tlv_get_u8(flow_tlvs[ROCKER_TLV_OF_DPA_IP_ECN_MASK]) << 6;
     }
-
-    return ROCKER_OK;
 }
 
 static int of_dpa_cmd_add_acl(OfDpaFlow *flow, RockerTlv **flow_tlvs)
@@ -1689,7 +1687,6 @@ static int of_dpa_cmd_add_acl(OfDpaFlow *flow, RockerTlv **flow_tlvs)
         ACL_MODE_ANY_VLAN,
         ACL_MODE_ANY_TENANT,
     } mode = ACL_MODE_UNKNOWN;
-    int err = ROCKER_OK;
 
     if (!flow_tlvs[ROCKER_TLV_OF_DPA_IN_PPORT] ||
         !flow_tlvs[ROCKER_TLV_OF_DPA_ETHERTYPE]) {
@@ -1776,14 +1773,10 @@ static int of_dpa_cmd_add_acl(OfDpaFlow *flow, RockerTlv **flow_tlvs)
     switch (ntohs(key->eth.type)) {
     case 0x0800:
     case 0x86dd:
-        err = of_dpa_cmd_add_acl_ip(key, mask, flow_tlvs);
+        of_dpa_cmd_add_acl_ip(key, mask, flow_tlvs);
         break;
     }
 
-    if (err) {
-        return err;
-    }
-
     if (flow_tlvs[ROCKER_TLV_OF_DPA_GROUP_ID]) {
         action->write.group_id =
             rocker_tlv_get_le32(flow_tlvs[ROCKER_TLV_OF_DPA_GROUP_ID]);
-- 
2.34.1



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

* Re: [PATCH] hw/net/rocker/rocker_of_dpa.c: Remove superfluous error check
  2024-11-12  1:26 [PATCH] hw/net/rocker/rocker_of_dpa.c: Remove superfluous error check Rodrigo Dias Correa
@ 2024-11-13 10:32 ` Ján Tomko
  0 siblings, 0 replies; 2+ messages in thread
From: Ján Tomko @ 2024-11-13 10:32 UTC (permalink / raw)
  To: Rodrigo Dias Correa; +Cc: qemu-devel, jiri, jasowang

[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]

On a Tuesday in 2024, Rodrigo Dias Correa wrote:
>of_dpa_cmd_add_acl_ip() is called from a single place, and despite the
>fact that it always returns ROCKER_OK, its return value is still checked
>by the caller.
>Change of_dpa_cmd_add_acl_ip() to return void and remove the superfluous
>check from of_dpa_cmd_add_acl().
>Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2471
>
>Signed-off-by: Rodrigo Dias Correa <r@drigo.nl>
>---
> hw/net/rocker/rocker_of_dpa.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
>diff --git a/hw/net/rocker/rocker_of_dpa.c b/hw/net/rocker/rocker_of_dpa.c
>index 5e16056be6..6d29130ec2 100644
>--- a/hw/net/rocker/rocker_of_dpa.c
>+++ b/hw/net/rocker/rocker_of_dpa.c
>@@ -1635,7 +1635,7 @@ static int of_dpa_cmd_add_multicast_routing(OfDpaFlow *flow,
>     return ROCKER_OK;
> }
>
>-static int of_dpa_cmd_add_acl_ip(OfDpaFlowKey *key, OfDpaFlowKey *mask,
>+static void of_dpa_cmd_add_acl_ip(OfDpaFlowKey *key, OfDpaFlowKey *mask,
>                                  RockerTlv **flow_tlvs)

The second line is misalgined.

> {
>     key->width = FLOW_KEY_WIDTH(ip.tos);

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2024-11-13 10:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-12  1:26 [PATCH] hw/net/rocker/rocker_of_dpa.c: Remove superfluous error check Rodrigo Dias Correa
2024-11-13 10:32 ` Ján Tomko

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.