linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: iio: industrialio-core: add check when kzalloc fails
@ 2019-01-24 14:28 Bharath Vedartham
  2019-01-25  6:55 ` Alexandru Ardelean
  2019-01-27 23:08 ` valdis.kletnieks
  0 siblings, 2 replies; 5+ messages in thread
From: Bharath Vedartham @ 2019-01-24 14:28 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw; +Cc: linux-iio, linux-kernel

add code to handle the case when kzalloc fails to allocate memory to dev

Signed-off-by: Bharath Vedartham <linux.bhar@gmail.com>
---
 drivers/iio/industrialio-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 4f5cd9f..93caa6b 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -1475,6 +1475,8 @@ struct iio_dev *iio_device_alloc(int sizeof_priv)
 		}
 		dev_set_name(&dev->dev, "iio:device%d", dev->id);
 		INIT_LIST_HEAD(&dev->buffer_list);
+	} else {
+		return NULL;
 	}
 
 	return dev;
-- 
2.7.4


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

end of thread, other threads:[~2019-01-27 23:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-24 14:28 [PATCH] drivers: iio: industrialio-core: add check when kzalloc fails Bharath Vedartham
2019-01-25  6:55 ` Alexandru Ardelean
2019-01-25 10:53   ` Himanshu Jha
2019-01-25 11:40     ` Bharath Vedartham
2019-01-27 23:08 ` valdis.kletnieks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).