All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging/xillybus: Handle OOM in xillybus_init()
@ 2014-03-18 23:07 Richard Weinberger
  2014-03-18 23:18 ` Eli Billauer
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Weinberger @ 2014-03-18 23:07 UTC (permalink / raw)
  To: eli.billauer; +Cc: gregkh, devel, linux-kernel, Richard Weinberger

alloc_workqueue() can fail and returns NULL in case of
OOM.
Handle this case and undo class_create().

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/staging/xillybus/xillybus_core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c
index 2ebaf16..b0a6696 100644
--- a/drivers/staging/xillybus/xillybus_core.c
+++ b/drivers/staging/xillybus/xillybus_core.c
@@ -2318,8 +2318,12 @@ static int __init xillybus_init(void)
 	}
 
 	xillybus_wq = alloc_workqueue(xillyname, 0, 0);
+	if (!xillybus_wq) {
+		class_destroy(xillybus_class);
+		rc = -ENOMEM;
+	}
 
-	return 0; /* Success */
+	return rc;
 }
 
 static void __exit xillybus_exit(void)
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging/xillybus: Handle OOM in xillybus_init()
  2014-03-18 23:07 [PATCH] staging/xillybus: Handle OOM in xillybus_init() Richard Weinberger
@ 2014-03-18 23:18 ` Eli Billauer
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Billauer @ 2014-03-18 23:18 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: gregkh, devel, linux-kernel

Hi,

I stand (shamefully) corrected. Thanks.

   Eli

On 19/03/14 01:07, Richard Weinberger wrote:
> alloc_workqueue() can fail and returns NULL in case of
> OOM.
> Handle this case and undo class_create().
>
> Signed-off-by: Richard Weinberger<richard@nod.at>
> ---
>   drivers/staging/xillybus/xillybus_core.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c
> index 2ebaf16..b0a6696 100644
> --- a/drivers/staging/xillybus/xillybus_core.c
> +++ b/drivers/staging/xillybus/xillybus_core.c
> @@ -2318,8 +2318,12 @@ static int __init xillybus_init(void)
>   	}
>
>   	xillybus_wq = alloc_workqueue(xillyname, 0, 0);
> +	if (!xillybus_wq) {
> +		class_destroy(xillybus_class);
> +		rc = -ENOMEM;
> +	}
>
> -	return 0; /* Success */
> +	return rc;
>   }
>
>   static void __exit xillybus_exit(void)
>    



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-18 23:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-18 23:07 [PATCH] staging/xillybus: Handle OOM in xillybus_init() Richard Weinberger
2014-03-18 23:18 ` Eli Billauer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.