Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp316690imu; Fri, 25 Jan 2019 02:53:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN7qlAc3hDyTSjdwOWk9oFRBW4iw4PzUmCzuv/9E1eKIaQlCKvAZI8QFA3q4mESKhSdaiYQw X-Received: by 2002:a63:31cc:: with SMTP id x195mr9630353pgx.52.1548413628242; Fri, 25 Jan 2019 02:53:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548413628; cv=none; d=google.com; s=arc-20160816; b=wW/Uav/DCDZbqGJqKou0HMripFyRZQ0eoXM/tGacKbhiJo95wgkKa0eGdCZuY+P18m UCYjFEqdKogiJxTVIBUrWConZckiz+Tb3vqz0YTHo/jSC9/89xrQktK9M+8v9l8eMCK6 8t1zjn4YInBk9jYF/jPkc++5LftHreqTA/QIPfyVDmdmJunoFiVxhpJwCW/HRIDL73HV zohMoRq91zVzqZc64M4mqlppRQEQQ3ayPC8iZuYbSg84QXIx1GWNGhzQkvwVLl+0ubSi HGDn8leSWo5/ifqqxhlwTyvW4SwJJRLe8eOxqa8hUb/rAGr87spAtYuaQPPts5zLCxZi 4lCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=L91MzvIDdYc15dcB4zub4pVbI3kUIlxSQxQ4CtMFeUg=; b=u4kvs8g82QBDY78Af84xRD7hDt0Lv4//322VpXkN9B4nRKLcSEhaI/zf3zio3jwL7r bV8KlOlpP7Vdem5KE6RCwxSfUFXj9ghA7yAcontfEDWFWBvJrDByltP+RYql4nOYcOWW v9FT2jQwq7xhokmY/+z/svMoQyA4QiTYbPpllGZ8lmKJMS3DwMM+S5VYiav8ikZdRF57 fcXOcBDf0uXhHe8MSgDkddxU0Aux5H+Q+QGFGfCPlym9Dh7eZXSHXh9F4qBs7Slcp3N/ PaBTb+DD+NpKhgi4CEQ/ER4UMlCH6rn9gKLfrZF43NLws6aNxum1KXbcKYF/tvSSzI2s UQvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YeVa+flA; 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 t6si25689708plz.96.2019.01.25.02.53.32; Fri, 25 Jan 2019 02:53:48 -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=YeVa+flA; 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 S1726311AbfAYKxW (ORCPT + 99 others); Fri, 25 Jan 2019 05:53:22 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44776 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725909AbfAYKxW (ORCPT ); Fri, 25 Jan 2019 05:53:22 -0500 Received: by mail-pf1-f196.google.com with SMTP id u6so4576582pfh.11; Fri, 25 Jan 2019 02:53:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=L91MzvIDdYc15dcB4zub4pVbI3kUIlxSQxQ4CtMFeUg=; b=YeVa+flAOTHV/vGbsnDqk7YesNYLq2GhYxqwpObfIztwUsYl8R7CYn+SBIrYhvyHi6 +IdqA0jIKu0sOooEUzGkRDlHXBH+QUKdOyPjjQu30eYuP23Uh7ZG3oFmW0oL8uQFxftn /nBs9qaEvHCXMuaevtRBw/2BXnCKUF12zeZyoYBrgBWU7ojcWMqbttLJq6A2qCE3wIw0 ca4c8wkI8S7Lnq6kx1ZD7uT6E3MTrHgNX6chYgOXnZbjx0YNSYzADkTOSCakyMS3wQuP irXgKaOmszQHT0lW1+p0BsrUJ06rbGXkgtfymYr14rgSG/mNjFSZr8+UlG5WUh0lJv5c llxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=L91MzvIDdYc15dcB4zub4pVbI3kUIlxSQxQ4CtMFeUg=; b=lKox0lyVceHpRSpMi3Rl1s0ygrE1BYU3rh5Ykx2RcqT/56tVELeBmTkVBSraOyLjLT QwEiX1ZfGA6ZJ2iXfU6jgr0YZ+4ElFLS4A6gMKEebywafJJ2R308U8/EQvPhUj3kFnAN RGNaf/BldAtRQEBJG0pikDUSTCqMRMi89JO46igUb6e41y8jk3bv65E6cTHTbrNoMrvb /vVp2MtDolBtp7KMbJXZ0GFMtkSb8A0CwsVs0pA++RmZVA4QmDyub5+em1T3tJAyufRT nQTQcqHg5H9ANxwzDojlcQQYQw/8SmrrgNAXlq3GPPgPII6qu/p1aZx9zRIPNfIjupcf 1yWA== X-Gm-Message-State: AJcUukfYf43spc2pzklGn7J3+4lZhyxP9H9VJcAAoipaEyuJQANiJ87V Kl7suP5+qm0cYGvU3rwsm70= X-Received: by 2002:a62:2f06:: with SMTP id v6mr10560033pfv.216.1548413601065; Fri, 25 Jan 2019 02:53:21 -0800 (PST) Received: from himanshu-Vostro-3559 ([103.233.116.134]) by smtp.gmail.com with ESMTPSA id q75sm49621022pfa.38.2019.01.25.02.53.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Jan 2019 02:53:20 -0800 (PST) Date: Fri, 25 Jan 2019 16:23:13 +0530 From: Himanshu Jha To: Alexandru Ardelean Cc: Bharath Vedartham , 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 Message-ID: <20190125105313.GA16451@himanshu-Vostro-3559> References: <20190124142755.GA31059@bhar.linux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 25, 2019 at 08:55:27AM +0200, Alexandru Ardelean wrote: > On Thu, Jan 24, 2019 at 4:28 PM Bharath Vedartham wrote: > > > > add code to handle the case when kzalloc fails to allocate memory to dev > > > > Signed-off-by: Bharath Vedartham > > --- > > 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