Commit 1acd14bf authored by Markus Elfring's avatar Markus Elfring Committed by Linus Torvalds

rapidio: return an error code only as a constant in two functions

* Return an error code without storing it in an intermediate variable.

* Delete the label "out" and local variable "rc" which became unnecessary
  with this refactoring.

Link: http://lkml.kernel.org/r/8db441e1-c227-64e7-4747-095da63d7a2e@users.sourceforge.netSigned-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Acked-by: default avatarAlexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 002f6f40
...@@ -402,13 +402,10 @@ rio_setup_inb_dbell(struct rio_mport *mport, void *dev_id, struct resource *res, ...@@ -402,13 +402,10 @@ rio_setup_inb_dbell(struct rio_mport *mport, void *dev_id, struct resource *res,
void (*dinb) (struct rio_mport * mport, void *dev_id, u16 src, u16 dst, void (*dinb) (struct rio_mport * mport, void *dev_id, u16 src, u16 dst,
u16 info)) u16 info))
{ {
int rc = 0;
struct rio_dbell *dbell = kmalloc(sizeof(*dbell), GFP_KERNEL); struct rio_dbell *dbell = kmalloc(sizeof(*dbell), GFP_KERNEL);
if (!dbell) { if (!dbell)
rc = -ENOMEM; return -ENOMEM;
goto out;
}
dbell->res = res; dbell->res = res;
dbell->dinb = dinb; dbell->dinb = dinb;
...@@ -417,9 +414,7 @@ rio_setup_inb_dbell(struct rio_mport *mport, void *dev_id, struct resource *res, ...@@ -417,9 +414,7 @@ rio_setup_inb_dbell(struct rio_mport *mport, void *dev_id, struct resource *res,
mutex_lock(&mport->lock); mutex_lock(&mport->lock);
list_add_tail(&dbell->node, &mport->dbells); list_add_tail(&dbell->node, &mport->dbells);
mutex_unlock(&mport->lock); mutex_unlock(&mport->lock);
return 0;
out:
return rc;
} }
/** /**
...@@ -563,21 +558,17 @@ int rio_add_mport_pw_handler(struct rio_mport *mport, void *context, ...@@ -563,21 +558,17 @@ int rio_add_mport_pw_handler(struct rio_mport *mport, void *context,
int (*pwcback)(struct rio_mport *mport, int (*pwcback)(struct rio_mport *mport,
void *context, union rio_pw_msg *msg, int step)) void *context, union rio_pw_msg *msg, int step))
{ {
int rc = 0;
struct rio_pwrite *pwrite = kzalloc(sizeof(*pwrite), GFP_KERNEL); struct rio_pwrite *pwrite = kzalloc(sizeof(*pwrite), GFP_KERNEL);
if (!pwrite) { if (!pwrite)
rc = -ENOMEM; return -ENOMEM;
goto out;
}
pwrite->pwcback = pwcback; pwrite->pwcback = pwcback;
pwrite->context = context; pwrite->context = context;
mutex_lock(&mport->lock); mutex_lock(&mport->lock);
list_add_tail(&pwrite->node, &mport->pwrites); list_add_tail(&pwrite->node, &mport->pwrites);
mutex_unlock(&mport->lock); mutex_unlock(&mport->lock);
out: return 0;
return rc;
} }
EXPORT_SYMBOL_GPL(rio_add_mport_pw_handler); EXPORT_SYMBOL_GPL(rio_add_mport_pw_handler);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment