Re: [PATCH 1/2] staging: slicoss: rewrite eeprom checksum code

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

 



On Sat, 2014-05-17 at 21:00 -0700, David Matlack wrote:
[]
> diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
[]
> +static inline u16 __reduce(u32 checksum)
> +{
> +	u16 lower_16 = checksum & 0xFFFF;
> +	u16 upper_16 = (checksum >> 16) & 0xFFFF;
> +
> +	checksum = lower_16 + upper_16;
> +
> +	if (checksum > 65535)
> +		checksum -= 65535;
> +
> +	return checksum;
> +}

The if seems unnecessary.

Perhaps declare a u16 return var or use

	return lower_16 + upper_16;


_______________________________________________
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