powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative

2008-11-29 Thread roel kluin
unsigned hp->count and hvcsd->open_count cannot be negative Signed-off-by: Roel Kluin <[EMAIL PROTECTED]> --- Both members of respectively struct hvcs_struct, see vi drivers/char/hvcs.c +262 and struct hvcs_struct, see vi drivers/char/hvsi.c +70 diff --git a/drivers/char/hvcs.c b/drivers/char/hv

[PATCH] [POWERPC] smu_sat_get_sdb_partition() - unsigned len cannot be negative

2008-11-29 Thread roel kluin
i2c_smbus_read_word_data() returns a s32, which may be negative but unsigned len cannot be negative. Signed-off-by: Roel Kluin <[EMAIL PROTECTED]> --- for i2c_smbus_read_word_data(), see vi drivers/i2c/i2c-core.c +1663 diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfar

[PATCH] powerpc: hvc_close() unsigned hp->count cannot be negative

2008-11-29 Thread roel kluin
unsigned hp->count cannot be negative Signed-off-by: Roel Kluin <[EMAIL PROTECTED]> --- Similar to the previous patch but with lock. For hvc_struct, see vi drivers/char/hvc_console.h +47 diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 5b819b1..337f6c6 100644 --- a/drive

Re: powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative

2008-11-29 Thread Andreas Schwab
roel kluin <[EMAIL PROTECTED]> writes: > - if (--hvcsd->open_count == 0) { > + if (hvcsd->open_count == 1) { > + hvcsd->open_count--; This is not the same. > - if (--hp->count == 0) { > + if (hp->count == 1) { > + hp->count--; Likewise. Andreas. -- And

Re: powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative

2008-11-29 Thread roel kluin
Andreas Schwab wrote: > roel kluin <[EMAIL PROTECTED]> writes: > >> -if (--hvcsd->open_count == 0) { >> +if (hvcsd->open_count == 1) { >> +hvcsd->open_count--; > > This is not the same. I think you're missing that I also decrement if (hvcsd->open_count > 1) If not, please ela

Re: powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative

2008-11-29 Thread Andreas Schwab
roel kluin <[EMAIL PROTECTED]> writes: > Andreas Schwab wrote: >> roel kluin <[EMAIL PROTECTED]> writes: >> >>> - if (--hvcsd->open_count == 0) { >>> + if (hvcsd->open_count == 1) { >>> + hvcsd->open_count--; >> >> This is not the same. > > I think you're missing that I also decrem

Re: powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative

2008-11-29 Thread Paul Mackerras
roel kluin writes: > unsigned hp->count and hvcsd->open_count cannot be negative ... > - if (--hvcsd->open_count == 0) { > + if (hvcsd->open_count == 1) { > + hvcsd->open_count--; Why are we no longer decrementing hvcsd->open_count in the cases where it is greater than 1? > -