Alan Cox writes:
> See the tty_port patches in -next - this is an argument about code which
> ought eventually to go away replaced by standard helper functions.
OK. In that case I think the best fix for the existing code is just
to change the count to be int rather than unsigned int.
Paul.
> Also, I don't see why those changes have anything to do with "unsigned
> things cannot be negative". As long as those counts are never zero on
> entry to those code sections, the existing code is fine, and I believe
> that assertion can be maintained. If you believe the code needs to
> defend a
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?
> -
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
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
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
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