lkml.org 
[lkml]   [2021]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] dio: return -ENOMEM when kzalloc() fails
Return -ENOMEM when kzalloc() fails in order to inform the caller of the
failure.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
drivers/dio/dio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dio/dio.c b/drivers/dio/dio.c
index 193b40e7aec0..4c06c93c93d3 100644
--- a/drivers/dio/dio.c
+++ b/drivers/dio/dio.c
@@ -219,7 +219,7 @@ static int __init dio_init(void)
/* Found a board, allocate it an entry in the list */
dev = kzalloc(sizeof(struct dio_dev), GFP_KERNEL);
if (!dev)
- return 0;
+ return -ENOMEM;

dev->bus = &dio_bus;
dev->dev.parent = &dio_bus.dev;
--
2.25.1
\
 
 \ /
  Last update: 2021-07-02 15:32    [W:0.531 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site