[PATCH] staging: kpc2000: simplify nested conditionals that just return a boolean.

Dan Carpenter dan.carpenter at oracle.com
Sat May 25 14:23:13 UTC 2019


On Fri, May 24, 2019 at 01:19:26PM +0100, Jeremy Sowden wrote:
> kp2000_check_uio_irq contained a pair of nested ifs which each evaluated
> a bitwise operation.  If both operations yielded true, the function
> returned 1; otherwise it returned 0.
> 
> Replaced the whole thing with one return statement that evaluates the
> combination of both bitwise operations.
> 
> Signed-off-by: Jeremy Sowden <jeremy at azazel.net>
> ---
> This applies to staging-testing.
> 
> I was in two minds whether to send this patch or something less terse:
> 
> +	return (interrupt_active & irq_check_mask) &&
> +	       (interrupt_mask_inv & irq_check_mask);

Yeah.  I would prefer this.

regards,
dan carpenter




More information about the devel mailing list