diff mbox series

[net-next] openvswitch: Use IS_ERR instead of IS_ERR_OR_NULL

Message ID 20201031060153.39912-1-yuehaibing@huawei.com
State Accepted
Delegated to: David Miller
Headers show
Series [net-next] openvswitch: Use IS_ERR instead of IS_ERR_OR_NULL | expand

Checks

Context Check Description
jkicinski/patch_count success Link
jkicinski/cover_letter success Link
jkicinski/fixes_present success Link
jkicinski/tree_selection success Clearly marked for net-next
jkicinski/subject_prefix success Link
jkicinski/source_inline success Was 0 now: 0
jkicinski/verify_signedoff success Link
jkicinski/module_param success Was 0 now: 0
jkicinski/build_32bit success Errors and warnings before: 0 this patch: 0
jkicinski/kdoc success Errors and warnings before: 0 this patch: 0
jkicinski/verify_fixes success Link
jkicinski/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
jkicinski/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
jkicinski/header_inline success Link
jkicinski/stable success Stable not CCed

Commit Message

Yue Haibing Oct. 31, 2020, 6:01 a.m. UTC
Fix smatch warning:

net/openvswitch/meter.c:427 ovs_meter_cmd_set() warn: passing zero to 'PTR_ERR'

dp_meter_create() never returns NULL, use IS_ERR
instead of IS_ERR_OR_NULL to fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 net/openvswitch/meter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tonghao Zhang Nov. 2, 2020, 1:21 a.m. UTC | #1
On Sat, Oct 31, 2020 at 2:02 PM YueHaibing <yuehaibing@huawei.com> wrote:
>
> Fix smatch warning:
>
> net/openvswitch/meter.c:427 ovs_meter_cmd_set() warn: passing zero to 'PTR_ERR'
>
> dp_meter_create() never returns NULL, use IS_ERR
> instead of IS_ERR_OR_NULL to fix this.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
>  net/openvswitch/meter.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
> index 8fbefd52af7f..15424d26e85d 100644
> --- a/net/openvswitch/meter.c
> +++ b/net/openvswitch/meter.c
> @@ -423,7 +423,7 @@ static int ovs_meter_cmd_set(struct sk_buff *skb, struct genl_info *info)
>                 return -EINVAL;
>
>         meter = dp_meter_create(a);
> -       if (IS_ERR_OR_NULL(meter))
> +       if (IS_ERR(meter))
>                 return PTR_ERR(meter);
>
>         reply = ovs_meter_cmd_reply_start(info, OVS_METER_CMD_SET,
> --
> 2.17.1
>
Jakub Kicinski Nov. 3, 2020, 1:36 a.m. UTC | #2
On Sat, 31 Oct 2020 14:01:53 +0800 YueHaibing wrote:
> Fix smatch warning:
> 
> net/openvswitch/meter.c:427 ovs_meter_cmd_set() warn: passing zero to 'PTR_ERR'
> 
> dp_meter_create() never returns NULL, use IS_ERR
> instead of IS_ERR_OR_NULL to fix this.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Applied, thanks!
diff mbox series

Patch

diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index 8fbefd52af7f..15424d26e85d 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -423,7 +423,7 @@  static int ovs_meter_cmd_set(struct sk_buff *skb, struct genl_info *info)
 		return -EINVAL;
 
 	meter = dp_meter_create(a);
-	if (IS_ERR_OR_NULL(meter))
+	if (IS_ERR(meter))
 		return PTR_ERR(meter);
 
 	reply = ovs_meter_cmd_reply_start(info, OVS_METER_CMD_SET,