RE: [PATCH 13/19] staging: comedi: amplc_pci230: remove unnecessary braces

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

 



On Tuesday, July 29, 2014 4:58 AM,  Ian Abbott wrote:
> Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
> ---
>  drivers/staging/comedi/drivers/amplc_pci230.c | 151 ++++++++++----------------
>  1 file changed, 58 insertions(+), 93 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c
> index 4222e28..df58679 100644
> --- a/drivers/staging/comedi/drivers/amplc_pci230.c
> +++ b/drivers/staging/comedi/drivers/amplc_pci230.c
> @@ -672,7 +672,7 @@ static int get_resources(struct comedi_device *dev, unsigned int res_mask,
>  	ok = 1;
>  	claimed = 0;
>  	spin_lock_irqsave(&devpriv->res_spinlock, irqflags);
> -	for (b = 1, i = 0; (i < NUM_RESOURCES) && res_mask; b <<= 1, i++) {
> +	for (b = 1, i = 0; (i < NUM_RESOURCES) && res_mask; b <<= 1, i++)
>  		if (res_mask & b) {
>  			res_mask &= ~b;
>  			if (devpriv->res_owner[i] == OWNER_NONE) {
> @@ -690,7 +690,6 @@ static int get_resources(struct comedi_device *dev, unsigned int res_mask,
>  				break;
>  			}
>  		}
> -	}

Technically the braces you remove in this patch _are_
unnecessary. But, I think the driver is more confusing
with them removed.

In a lot of places there is quite a bit of code between
where the opening and closing braces would be.
Granted, a lot of them are due to the wordy comments
but some are in places like:

	for (...)
		if (...) {
			...
		}

There aren't too bad but the one like this are:

	If (...)
		If (...)
			...
		else
			...
	else
		...

The nested if/else blocks are easy to break.

Just my two cents...
Hartley

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux