public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bharath Vedartham <linux.bhar@gmail.com>
To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drivers: iio: industrialio-core: add check when kzalloc fails
Date: Thu, 24 Jan 2019 19:58:00 +0530	[thread overview]
Message-ID: <20190124142755.GA31059@bhar.linux> (raw)

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


             reply	other threads:[~2019-01-24 14:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 14:28 Bharath Vedartham [this message]
2019-01-25  6:55 ` [PATCH] drivers: iio: industrialio-core: add check when kzalloc fails Alexandru Ardelean
2019-01-25 10:53   ` Himanshu Jha
2019-01-25 11:40     ` Bharath Vedartham
2019-01-27 23:08 ` valdis.kletnieks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190124142755.GA31059@bhar.linux \
    --to=linux.bhar@gmail.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox