linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas@ndufresne.ca>
To: Souptick Joarder <jrdr.linux@gmail.com>,
	pawel@osciak.com, m.szyprowski@samsung.com,
	kyungmin.park@samsung.com, mchehab@kernel.org
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	sabyasachi.linux@gmail.com, brajeswar.linux@gmail.com
Subject: Re: [PATCH] media: videobuf2: Return error after allocation failure
Date: Sun, 03 Feb 2019 16:54:59 -0500	[thread overview]
Message-ID: <22f10cf289b8115fa9e60f89edc24ec2cf0f676d.camel@ndufresne.ca> (raw)
In-Reply-To: <20190203133608.GA26010@jordon-HP-15-Notebook-PC>

Le dimanche 03 février 2019 à 19:06 +0530, Souptick Joarder a écrit :
> There is no point to continuing assignemnt after memory allocation

assignemnt -> assignment.

> failed, rather throw error immediately.
> 
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> ---
>  drivers/media/common/videobuf2/videobuf2-vmalloc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/common/videobuf2/videobuf2-vmalloc.c b/drivers/media/common/videobuf2/videobuf2-vmalloc.c
> index 6dfbd5b..d3f71e2 100644
> --- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c
> +++ b/drivers/media/common/videobuf2/videobuf2-vmalloc.c
> @@ -46,16 +46,16 @@ static void *vb2_vmalloc_alloc(struct device *dev, unsigned long attrs,
>  
>  	buf->size = size;
>  	buf->vaddr = vmalloc_user(buf->size);
> -	buf->dma_dir = dma_dir;
> -	buf->handler.refcount = &buf->refcount;
> -	buf->handler.put = vb2_vmalloc_put;
> -	buf->handler.arg = buf;
>  
>  	if (!buf->vaddr) {
>  		pr_debug("vmalloc of size %ld failed\n", buf->size);
>  		kfree(buf);
>  		return ERR_PTR(-ENOMEM);
>  	}
> +	buf->dma_dir = dma_dir;
> +	buf->handler.refcount = &buf->refcount;
> +	buf->handler.put = vb2_vmalloc_put;
> +	buf->handler.arg = buf;
>  
>  	refcount_set(&buf->refcount, 1);
>  	return buf;


  reply	other threads:[~2019-02-03 21:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-03 13:36 [PATCH] media: videobuf2: Return error after allocation failure Souptick Joarder
2019-02-03 21:54 ` Nicolas Dufresne [this message]
2019-02-04  2:03   ` Souptick Joarder

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=22f10cf289b8115fa9e60f89edc24ec2cf0f676d.camel@ndufresne.ca \
    --to=nicolas@ndufresne.ca \
    --cc=brajeswar.linux@gmail.com \
    --cc=jrdr.linux@gmail.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    --cc=pawel@osciak.com \
    --cc=sabyasachi.linux@gmail.com \
    /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).