Re: [PATCH] staging: olpc_dcon: signedness bug in dcon_interrupt()

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

 



On Thu, 1 Dec 2011 17:21:47 -0500
Xi Wang <xi.wang@xxxxxxxxx> wrote:

> The error handling with (status == -1) didn't work because "status"
> is a zero extension of a u8 from read_status().


Thanks for catching that.  I'd prefer to see this cleaned up, though.
Error handling and the status bits (of which we only use two) should be
separate.

ie, "int (*read_status)(u8 *status);"

Alternatively, we could have the high bit of that u8 mark an error,
but I think using two variables is much easier to understand.


> 
> Signed-off-by: Xi Wang <xi.wang@xxxxxxxxx>
> ---
>  drivers/staging/olpc_dcon/olpc_dcon.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c
> b/drivers/staging/olpc_dcon/olpc_dcon.c index af24ddf..f36b0d5 100644
> --- a/drivers/staging/olpc_dcon/olpc_dcon.c
> +++ b/drivers/staging/olpc_dcon/olpc_dcon.c
> @@ -755,7 +755,7 @@ static int dcon_resume(struct i2c_client *client)
>  irqreturn_t dcon_interrupt(int irq, void *id)
>  {
>  	struct dcon_priv *dcon = id;
> -	int status = pdata->read_status();
> +	s8 status = pdata->read_status();
>  
>  	if (status == -1)
>  		return IRQ_NONE;

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/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