Skip to content

Commit

Permalink
gigaset: fix error return code
Browse files Browse the repository at this point in the history
gigaset_register_to_LL() is expected to print a message and return 0
on failure. Make it do so consistently.

Impact: error handling bugfix
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tilman Schmidt authored and David S. Miller committed May 18, 2009
1 parent 1315d69 commit 7226d7c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drivers/isdn/gigaset/i4l.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,11 +544,11 @@ int gigaset_register_to_LL(struct cardstate *cs, const char *isdnid)

gig_dbg(DEBUG_ANY, "Register driver capabilities to LL");

//iif->id[sizeof(iif->id) - 1]=0;
//strncpy(iif->id, isdnid, sizeof(iif->id) - 1);
if (snprintf(iif->id, sizeof iif->id, "%s_%u", isdnid, cs->minor_index)
>= sizeof iif->id)
return -ENOMEM; //FIXME EINVAL/...??
>= sizeof iif->id) {
pr_err("ID too long: %s\n", isdnid);
return 0;
}

iif->owner = THIS_MODULE;
iif->channels = cs->channels;
Expand All @@ -568,8 +568,10 @@ int gigaset_register_to_LL(struct cardstate *cs, const char *isdnid)
iif->rcvcallb_skb = NULL; /* Will be set by LL */
iif->statcallb = NULL; /* Will be set by LL */

if (!register_isdn(iif))
if (!register_isdn(iif)) {
pr_err("register_isdn failed\n");
return 0;
}

cs->myid = iif->channels; /* Set my device id */
return 1;
Expand Down

0 comments on commit 7226d7c

Please sign in to comment.