linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Himanshu Jha <himanshujha199640@gmail.com>
To: Alexandru Ardelean <ardeleanalex@gmail.com>
Cc: Bharath Vedartham <linux.bhar@gmail.com>,
	jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de,
	pmeerw@pmeerw.net, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers: iio: industrialio-core: add check when kzalloc fails
Date: Fri, 25 Jan 2019 16:23:13 +0530	[thread overview]
Message-ID: <20190125105313.GA16451@himanshu-Vostro-3559> (raw)
In-Reply-To: <CA+U=Dsrefk01AbyKmkhLrwQyq8mkBKoO6kv_zXYEFSSCCqDObw@mail.gmail.com>

On Fri, Jan 25, 2019 at 08:55:27AM +0200, Alexandru Ardelean wrote:
> On Thu, Jan 24, 2019 at 4:28 PM Bharath Vedartham <linux.bhar@gmail.com> wrote:
> >
> > 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;
> 
> I'd argue that this is a bit redundant, because `dev` is NULL, the
> return below (return dev) will also return NULL.

+1

Also, subject title is incorrect.

Always use:

$ git log --oneline drivers/iio/industrialio-core.c

Use the most frequently tag/subject from the output of above
command.

"iio: core: ...." would be fine.


-- 
Himanshu Jha
Undergraduate Student
Department of Electronics & Communication
Guru Tegh Bahadur Institute of Technology

  reply	other threads:[~2019-01-25 10:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=20190125105313.GA16451@himanshu-Vostro-3559 \
    --to=himanshujha199640@gmail.com \
    --cc=ardeleanalex@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=linux.bhar@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).