mlxsw: reg: Allow to pass NULL pointer to mlxsw_reg_ralue_pack4/6()
authorJiri Pirko <jiri@nvidia.com>
Tue, 10 Nov 2020 09:48:53 +0000 (11:48 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 12 Nov 2020 23:55:20 +0000 (15:55 -0800)
In preparation for the change that is going to be done in the next
patch, allow to pass NULL pointer to mlxsw_reg_ralue_pack4() and
mlxsw_reg_ralue_pack6() helpers.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/reg.h

index 0da9f7e..fcf9095 100644 (file)
@@ -7282,7 +7282,8 @@ static inline void mlxsw_reg_ralue_pack4(char *payload,
                                         u32 *dip)
 {
        mlxsw_reg_ralue_pack(payload, protocol, op, virtual_router, prefix_len);
-       mlxsw_reg_ralue_dip4_set(payload, *dip);
+       if (dip)
+               mlxsw_reg_ralue_dip4_set(payload, *dip);
 }
 
 static inline void mlxsw_reg_ralue_pack6(char *payload,
@@ -7292,7 +7293,8 @@ static inline void mlxsw_reg_ralue_pack6(char *payload,
                                         const void *dip)
 {
        mlxsw_reg_ralue_pack(payload, protocol, op, virtual_router, prefix_len);
-       mlxsw_reg_ralue_dip6_memcpy_to(payload, dip);
+       if (dip)
+               mlxsw_reg_ralue_dip6_memcpy_to(payload, dip);
 }
 
 static inline void