]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net: microchip: vcap api: Use ERR_CAST() in vcap_decode_rule()
authorLi Zetao <lizetao1@huawei.com>
Wed, 2 Aug 2023 09:31:56 +0000 (17:31 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 Aug 2023 08:00:23 +0000 (09:00 +0100)
There is a warning reported by coccinelle:

./drivers/net/ethernet/microchip/vcap/vcap_api.c:2399:9-16: WARNING:
ERR_CAST can be used with ri

Use ERR_CAST instead of ERR_PTR + PTR_ERR to simplify the
conversion process.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/microchip/vcap/vcap_api.c

index a418ad8e8770ab8fb24f05be066422552c808cb6..a7b43f99bc808f709da1d7e5ed22a90722d7b477 100644 (file)
@@ -2396,7 +2396,7 @@ struct vcap_rule *vcap_decode_rule(struct vcap_rule_internal *elem)
 
        ri = vcap_dup_rule(elem, elem->state == VCAP_RS_DISABLED);
        if (IS_ERR(ri))
-               return ERR_PTR(PTR_ERR(ri));
+               return ERR_CAST(ri);
 
        if (ri->state == VCAP_RS_DISABLED)
                goto out;