From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> Date: Thu, 12 Oct 2017 08:52:53 +0200 Add a jump target so that a bit of exception handling can be better reused at the end of this function. Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- drivers/staging/irda/net/irias_object.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/irda/net/irias_object.c b/drivers/staging/irda/net/irias_object.c index 4c2c65e28836..0c89800d597d 100644 --- a/drivers/staging/irda/net/irias_object.c +++ b/drivers/staging/irda/net/irias_object.c @@ -54,10 +54,9 @@ struct ias_object *irias_new_object( char *name, int id) obj->magic = IAS_OBJECT_MAGIC; obj->name = kstrndup(name, IAS_MAX_CLASSNAME, GFP_ATOMIC); - if (!obj->name) { - kfree(obj); - return NULL; - } + if (!obj->name) + goto free_object; + obj->id = id; /* Locking notes : the attrib spinlock has lower precendence @@ -68,11 +67,14 @@ struct ias_object *irias_new_object( char *name, int id) net_warn_ratelimited("%s(), Unable to allocate attribs!\n", __func__); kfree(obj->name); - kfree(obj); - return NULL; + goto free_object; } return obj; + +free_object: + kfree(obj); + return NULL; } EXPORT_SYMBOL(irias_new_object); -- 2.14.2 -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html