# Re: \[PATCH 1/2\] net: core: datagram.c: Fix use of assignment in if condition

- From: Eric Dumazet \<hidden\>
- Date: 2021-03-11 11:00:49 
- List: netdev
- Page: https://ratatoskr.run/netdev/2021/03/6296550
- Thread: https://ratatoskr.run/netdev/2021/03/6296514/t.md

```text
On Thu, Mar 11, 2021 at 11:34 AM Shubhankar Kuranagatti
[ref] wrote:
>
> The assignment inside the if condition has been changed to
> initialising outside the if condition.
>
> Signed-off-by: Shubhankar Kuranagatti <redacted>
> ---
>  net/core/datagram.c | 31 ++++++++++++++++++++-----------
>  1 file changed, 20 insertions(+), 11 deletions(-)
>
> diff --git a/net/core/datagram.c b/net/core/datagram.c
> index 15ab9ffb27fe..7b2204f102b7 100644
> --- a/net/core/datagram.c
> +++ b/net/core/datagram.c
> @@ -427,7 +427,8 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
>                 offset += n;
>                 if (n != copy)
>                         goto short_copy;
> -               if ((len -= copy) == 0)
> +               len -= copy
> +               if ((len) == 0)
>                         return 0;
>


Quite frankly I prefer the current style.

It also seems you have not even compiled your change, this is not a good start.

Lets keep reviewer time to review patches that really bring an improvement,
since stylistic changes like that make our backports more likely to
have conflicts.

Thanks.
```
