Re: [PATCH v1 06/10] j1939: transport: j1939_xtp_rx_rts: remove useless check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed,  5 Dec 2018 07:07:53 +0100
Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> wrote:

> j1939_xtp_rx_rts() is called only in cases:
> - J1939_ETP_CMD_RTS, extd == 1
> - J1939_TP_CMD_RTS, extd == 0
> - J1939_TP_CMD_BAM, extd == 0
> 
> it means, this test is:
> if (J1939_ETP_CMD_RTS || !J1939_TP_CMD_BAM)
> or (J1939_ETP_CMD_RTS || J1939_TP_CMD_RTS)
> 
> it is enough to test !J1939_TP_CMD_BAM
> 
> Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> ---
>  net/can/j1939/transport.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
> index 2ccb1f448d91..7652e129c804 100644
> --- a/net/can/j1939/transport.c
> +++ b/net/can/j1939/transport.c
> @@ -1099,10 +1099,9 @@ static void j1939_xtp_rx_rts(struct j1939_priv *priv, struct sk_buff *skb,
>  
>  	j1939_tp_set_rxtimeout(session, 1250);
>  
> -	if (j1939_tp_im_receiver(session->skb)) {
> -		if (extd || dat[0] != J1939_TP_CMD_BAM)
> -			j1939_tp_schedule_txtimer(session, 0);
> -	}
> +	if ((dat[0] != J1939_TP_CMD_BAM) &&
> +	    j1939_tp_im_receiver(session->skb))
> +		j1939_tp_schedule_txtimer(session, 0);

Why not use a single line conditional if it fits the 80 char cap?

>  
>   out_session_put:
>  	j1939_session_put(session);

Ack


-- 
Robin van der Gracht
Protonic Holland
tel.: +31 (0) 229 212928
fax.: +31 (0) 229 210930
Factorij 36 / 1689 AL Zwaag



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux