Re: [PATCH 01/10] lis3lv02d: avoid divide by zero due to unchecked

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

 



On Mon, 25 Jul 2011 17:16:23 +0200
__ric Piel <eric.piel@xxxxxxxxxxxxxxxx> wrote:

> +static int lis3lv02d_get_pwron_wait(struct lis3lv02d *lis3)
> +{
> +	int div = lis3lv02d_get_odr();
> +
> +	if (WARN_ONCE(div == 0, "device returned spurious data"))
> +		return -ENXIO;
> +
> +	/* LIS3 power on delay is quite long */
> +	msleep(lis3->pwron_delay / div);
> +	return 0;
> +}

The WARN_ONCE may not be very useful.  The user gets worried, might
report it (often to a distro, not to you!).  But we won't actually *do*
anything with the information?
--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux