diff options
author | Tilman Schmidt <tilman@imap.cc> | 2012-04-25 09:02:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-07 22:37:56 -0400 |
commit | 81fa7b82570ec4337d328e6aee45689455508821 (patch) | |
tree | 79cdb018f497a18635ea78a171cd211845e0b605 /drivers/isdn/gigaset/ser-gigaset.c | |
parent | 7643ffbd02ac46f880f64bed24a85d453b501418 (diff) |
isdn/gigaset: unify function return values
Various functions in the Gigaset driver were using different
conventions for the meaning of their int return values.
Align them to the usual negative error numbers convention.
Inspired-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/gigaset/ser-gigaset.c')
-rw-r--r-- | drivers/isdn/gigaset/ser-gigaset.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c index 6f3fd4cf4378..8c91fd5eb6fd 100644 --- a/drivers/isdn/gigaset/ser-gigaset.c +++ b/drivers/isdn/gigaset/ser-gigaset.c | |||
@@ -340,17 +340,16 @@ static int gigaset_initbcshw(struct bc_state *bcs) | |||
340 | { | 340 | { |
341 | /* unused */ | 341 | /* unused */ |
342 | bcs->hw.ser = NULL; | 342 | bcs->hw.ser = NULL; |
343 | return 1; | 343 | return 0; |
344 | } | 344 | } |
345 | 345 | ||
346 | /* | 346 | /* |
347 | * Free B channel structure | 347 | * Free B channel structure |
348 | * Called by "gigaset_freebcs" in common.c | 348 | * Called by "gigaset_freebcs" in common.c |
349 | */ | 349 | */ |
350 | static int gigaset_freebcshw(struct bc_state *bcs) | 350 | static void gigaset_freebcshw(struct bc_state *bcs) |
351 | { | 351 | { |
352 | /* unused */ | 352 | /* unused */ |
353 | return 1; | ||
354 | } | 353 | } |
355 | 354 | ||
356 | /* | 355 | /* |
@@ -398,7 +397,7 @@ static int gigaset_initcshw(struct cardstate *cs) | |||
398 | scs = kzalloc(sizeof(struct ser_cardstate), GFP_KERNEL); | 397 | scs = kzalloc(sizeof(struct ser_cardstate), GFP_KERNEL); |
399 | if (!scs) { | 398 | if (!scs) { |
400 | pr_err("out of memory\n"); | 399 | pr_err("out of memory\n"); |
401 | return 0; | 400 | return -ENOMEM; |
402 | } | 401 | } |
403 | cs->hw.ser = scs; | 402 | cs->hw.ser = scs; |
404 | 403 | ||
@@ -410,13 +409,13 @@ static int gigaset_initcshw(struct cardstate *cs) | |||
410 | pr_err("error %d registering platform device\n", rc); | 409 | pr_err("error %d registering platform device\n", rc); |
411 | kfree(cs->hw.ser); | 410 | kfree(cs->hw.ser); |
412 | cs->hw.ser = NULL; | 411 | cs->hw.ser = NULL; |
413 | return 0; | 412 | return rc; |
414 | } | 413 | } |
415 | dev_set_drvdata(&cs->hw.ser->dev.dev, cs); | 414 | dev_set_drvdata(&cs->hw.ser->dev.dev, cs); |
416 | 415 | ||
417 | tasklet_init(&cs->write_tasklet, | 416 | tasklet_init(&cs->write_tasklet, |
418 | gigaset_modem_fill, (unsigned long) cs); | 417 | gigaset_modem_fill, (unsigned long) cs); |
419 | return 1; | 418 | return 0; |
420 | } | 419 | } |
421 | 420 | ||
422 | /* | 421 | /* |
@@ -503,6 +502,7 @@ static int | |||
503 | gigaset_tty_open(struct tty_struct *tty) | 502 | gigaset_tty_open(struct tty_struct *tty) |
504 | { | 503 | { |
505 | struct cardstate *cs; | 504 | struct cardstate *cs; |
505 | int rc; | ||
506 | 506 | ||
507 | gig_dbg(DEBUG_INIT, "Starting HLL for Gigaset M101"); | 507 | gig_dbg(DEBUG_INIT, "Starting HLL for Gigaset M101"); |
508 | 508 | ||
@@ -515,8 +515,10 @@ gigaset_tty_open(struct tty_struct *tty) | |||
515 | 515 | ||
516 | /* allocate memory for our device state and initialize it */ | 516 | /* allocate memory for our device state and initialize it */ |
517 | cs = gigaset_initcs(driver, 1, 1, 0, cidmode, GIGASET_MODULENAME); | 517 | cs = gigaset_initcs(driver, 1, 1, 0, cidmode, GIGASET_MODULENAME); |
518 | if (!cs) | 518 | if (!cs) { |
519 | rc = -ENODEV; | ||
519 | goto error; | 520 | goto error; |
521 | } | ||
520 | 522 | ||
521 | cs->dev = &cs->hw.ser->dev.dev; | 523 | cs->dev = &cs->hw.ser->dev.dev; |
522 | cs->hw.ser->tty = tty; | 524 | cs->hw.ser->tty = tty; |
@@ -530,7 +532,8 @@ gigaset_tty_open(struct tty_struct *tty) | |||
530 | */ | 532 | */ |
531 | if (startmode == SM_LOCKED) | 533 | if (startmode == SM_LOCKED) |
532 | cs->mstate = MS_LOCKED; | 534 | cs->mstate = MS_LOCKED; |
533 | if (!gigaset_start(cs)) { | 535 | rc = gigaset_start(cs); |
536 | if (rc < 0) { | ||
534 | tasklet_kill(&cs->write_tasklet); | 537 | tasklet_kill(&cs->write_tasklet); |
535 | goto error; | 538 | goto error; |
536 | } | 539 | } |
@@ -542,7 +545,7 @@ error: | |||
542 | gig_dbg(DEBUG_INIT, "Startup of HLL failed"); | 545 | gig_dbg(DEBUG_INIT, "Startup of HLL failed"); |
543 | tty->disc_data = NULL; | 546 | tty->disc_data = NULL; |
544 | gigaset_freecs(cs); | 547 | gigaset_freecs(cs); |
545 | return -ENODEV; | 548 | return rc; |
546 | } | 549 | } |
547 | 550 | ||
548 | /* | 551 | /* |