Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp153453imb; Thu, 28 Feb 2019 19:17:27 -0800 (PST) X-Google-Smtp-Source: APXvYqz8cbQyq7w0FDtW4PP2040CqJfnJztYkB6kDViBhz/jHRyxFdAZpgdNO/YDlHejCAxqxyo6 X-Received: by 2002:a63:2808:: with SMTP id o8mr2687809pgo.188.1551410247581; Thu, 28 Feb 2019 19:17:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551410247; cv=none; d=google.com; s=arc-20160816; b=GdAb5QEhe+gdAZs00YSVDnoSDfE8ybiLKoP6D/x3ejpn0IIk54t7tvWBwGLSw5m8h9 P2Sr0d03VWtdoOh1ifzo+5O/mG7ZGwhnkE0wDmuvgHseYdvtcttcxzElFxLGEJMe3ooq WkJPadySyH8XtsUFvhSEdMN2Y6N6bV+r2t9IHv6EFp3XhOyO+AZ40DGeQ47U8jD66Fcm x97+EYOwGFcjYaAL19d65zgMFNKULjpk4Z042ZVGivnLy9rxuzGtxXSYUZ98tyyyTL+R 7XqtOvZ75fYuw1pOJvHhp3Kg7lHSzuA93IhgF2UTVHkN5V7CaZYss28gKyaTrasNKlHZ 9dAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=BBcKiv8lgJH8WjlVJtIZM3TkArsPsyv5C92UA5FRHXs=; b=LqoyEpJqxSCGjZyz3mCTFH0eIc090W3US623Htyds86UazFJ6AYa+G/9VWiwbDuV0R UxpPGnr59tXxtDA5kVXOJKIIAuUS4wVS0sMG0RSRkr1dZFMypfS5AurdwiJGOARhC/lY Alyj5ML5nIRnFSheRk0fIJEXgoDa3yrxude4Hf5AhKOD6CSymDqDB7NgOlaw1bFkqf1k xsPNe5JrTFSTDwrGaWCWo9RYL52GOVwigC79PiIxVre+TyKp7Im6hOzGaBY5CnFbfRVl H6OOPOAI0NvEGzeL9KYYCIunH83S4wuxHBBe4rBA0ZGW2t5UAL5IzltI6vZW2mozwG6o 6QKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iQPociG7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si19824920pfj.111.2019.02.28.19.17.12; Thu, 28 Feb 2019 19:17:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iQPociG7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731144AbfCADEr (ORCPT + 99 others); Thu, 28 Feb 2019 22:04:47 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:44562 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbfCADEr (ORCPT ); Thu, 28 Feb 2019 22:04:47 -0500 Received: by mail-lj1-f194.google.com with SMTP id q128so19037420ljb.11; Thu, 28 Feb 2019 19:04:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BBcKiv8lgJH8WjlVJtIZM3TkArsPsyv5C92UA5FRHXs=; b=iQPociG7Uc5+NGDOIle+vglwUmj+yq2QmCj9VMgUhHoIZCRL7CYbzTdn9nD54UxIWa ZCimAUSI1ZDDCVwgUVlgfUXUV3Gxw19GcFB/MTvm6MWL5wEAmcsqWcoUYJHsaoFa0gmG 88APCaas4i5JEA0Wkvk5L/FVWrZbhM16Q2n6aOONpxYUkBVfScT/3fTxKKgqX3aEJ6Vy yN4BMSWsQnruY7jzQojL+pg9ED2n7t0rAlK1giNh52mgNBxJ53gpqPqxNSIOyZ9hBx1W zUyLZuo4fgsNRYgXQZKxWRfSxvk6WJEb88cOLhnf3GczMIAkyawuUaPaTlF6mL8YZIu0 ebng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BBcKiv8lgJH8WjlVJtIZM3TkArsPsyv5C92UA5FRHXs=; b=g3aNgFIEI4YhPx9lvvcAZ/3/DtEvTuxHrf+sSeceeyf6vK5/asw7ApaxGOXEp1nkDT a25fe5dkZ7J8xc9E+/zLAnsChEZWpWYH9CaImxCAyoSL8riLnDwq/VvVoiDPVSZSv5jZ l3C2v3uwJ8ZuRH+1E9klS9ztL5GKXGWLEw7OxraB3KAX57FbTcLe6HWdVcxdMVotBWA5 LTTuzTbYY9ql9j0Gv+rE6IAFe9Fewz09nPEBjTGjdMmO2mNjOBWVokWX4dR+VCGGx2hh yhsQ8v81WwKRzenQISU38Yu+eUTcPYxAeTgl+2AdvQgRovdNGmcXVNvgqx7XUDqeMgzw V55g== X-Gm-Message-State: APjAAAUvqXVLpiThZF0wtmkaief9bleghIcL4UML90VagxIoypK4gVhY F/uBjjE5pT6oPSRRB5pSExQeZnra12ghnHNtyZU= X-Received: by 2002:a2e:54f:: with SMTP id 76mr1247303ljf.20.1551409484639; Thu, 28 Feb 2019 19:04:44 -0800 (PST) MIME-Version: 1.0 References: <20190204150142.GA3900@jordon-HP-15-Notebook-PC> In-Reply-To: From: Souptick Joarder Date: Fri, 1 Mar 2019 08:34:33 +0530 Message-ID: Subject: Re: [PATCHv2] media: videobuf2: Return error after allocation failure To: pawel@osciak.com, Marek Szyprowski , Kyungmin Park , mchehab@kernel.org, Nicolas Dufresne Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 11, 2019 at 7:42 AM Souptick Joarder wrote: > > On Mon, Feb 4, 2019 at 8:27 PM Souptick Joarder wrote: > > > > There is no point to continuing assignment after memory allocation > > failed, rather throw error immediately. > > > > Signed-off-by: Souptick Joarder > > Any comment on this patch ? If no further comment, can we get this patch in queue for 5.1 ? > > > --- > > v1 -> v2: > > Corrected typo in change log. > > > > 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; > > -- > > 1.9.1 > >