Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2856913imu; Sun, 27 Jan 2019 15:10:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN43RB/14Of50mC5iSF9MECDU7pxeRbi3oOlaWd8Ispmm73go1BxwzUPurgybSNoXN8GK0YJ X-Received: by 2002:a63:de46:: with SMTP id y6mr17739007pgi.198.1548630610365; Sun, 27 Jan 2019 15:10:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548630610; cv=none; d=google.com; s=arc-20160816; b=f9YXBDNp1VpR+/34r7nffG3KcuaBm9/OBd/9A4xiQ9u0v8UiB/MKKcXqQF869ivAuc sbui1tRe5N70ndVedbd4cMu+yXE5u++sGUkF9gNvfO9BBXmc1hwMXAPYNhbx16QOXNNg oCX2WJL88vO7/QTUisx2ip6pp6Py+1Z9P9PBWqUKzGP5I5j7kmfwYXD99adLeCMisoXq EyV6hgH6qfKg+Qi2UpHfONRraDWKiHCibYxz1e1syklhUftupfjikxN7CwARuGYkjcID aCJ7zgAiw8av91N2XJqZf8fIRTm1UUbTC+NAGwnjmn094uqOxvkhrK45C76smHGWq83W WJgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:mime-version:references :in-reply-to:subject:cc:to:from; bh=QQQI1VeREQLrhDI8VVdoD+egvcJS/4EzoFBcR02kzdA=; b=GZNMmj1bjSpWoDyN5k7AyUAwePMLNzkYZITCutY0VKXIplhSgg7VyALwW3/3Xf5yo4 AiWwa9gqhiIH8tdF8FF6KEP31CZDGTQuF1bKmJrISqb0e/u1Gv8bfjKkWE/a3su3Ryn2 pjnLCXHVxyJNCC/mXqXMy/O1SGU5xj1JEqEKq7a9fkvqd6OJrSOi9RqbZGemSnTllgh6 vRZJFXl8k3rx+2IX2s878pfZAQlRhMZ7S/yFGKkvZVxBdYnkBogALxaB+yjs2EC2jShb qG1XCECBlpE+mNxcBRVi3SPOFpxChOu+NVh8RAB83kokFpPii7VssiG2OYYgU5r7uAVm UuuQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=vt.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20si11043174plj.129.2019.01.27.15.09.53; Sun, 27 Jan 2019 15:10:10 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=vt.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726828AbfA0XIR (ORCPT + 99 others); Sun, 27 Jan 2019 18:08:17 -0500 Received: from outbound.smtp.vt.edu ([198.82.183.121]:46252 "EHLO omr2.cc.vt.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726302AbfA0XIQ (ORCPT ); Sun, 27 Jan 2019 18:08:16 -0500 Received: from mr3.cc.vt.edu (mr3.cc.ipv6.vt.edu [IPv6:2607:b400:92:8500:0:7f:b804:6b0a]) by omr2.cc.vt.edu (8.14.4/8.14.4) with ESMTP id x0RN8GrA025522 for ; Sun, 27 Jan 2019 18:08:16 -0500 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by mr3.cc.vt.edu (8.14.7/8.14.7) with ESMTP id x0RN8BqE006064 for ; Sun, 27 Jan 2019 18:08:16 -0500 Received: by mail-qt1-f198.google.com with SMTP id n45so18779915qta.5 for ; Sun, 27 Jan 2019 15:08:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :mime-version:date:message-id; bh=QQQI1VeREQLrhDI8VVdoD+egvcJS/4EzoFBcR02kzdA=; b=lEFBMeAI6J5K8ps2AKhFzv4zxDpRLc8vqVrFc9bc6HWs3kMaXw/J6Y2cU42qroKs+k Zm8dXoRJMnsKyHRS/ufgiQVik6NS79Dc9EENdkjD54pLMLk626M30ZSEn/gPNfaU1bQy y1fnAJpIjK3GZ8jfVWupSd+VW2pvlnBqdRAAOTZPWSbIHu4NhWBMSfclYDkdPbvwiZlx RDVk2AQgkVd2tFHVxJua4O1lZN7qS1DnzIFyZVkFgCL4+4aZc8kmGQKz8bKqpCNlh6yi so+4zmA0CHQoHymD1Ffcq4zf3epIdbciYWIs66VBha1lig7jDjn+lRC9aXgSq9VLlxjL PuXQ== X-Gm-Message-State: AJcUukfEcpBa6PRdxVpDVKCVsW/UYds9O/2A1p7I1Bh6Opu4UKq4XxuK L0LWeESq0lkL+nCw0uzVcKDUETTeQSS7L/evup/AgJOwZdLsmQveQTTX++X3/tKudwES3Bim3Fg 5JxuLI8CdQ/JSvDnOX2EmsujfDqALOrA/iFU= X-Received: by 2002:a37:61cd:: with SMTP id v196mr17796082qkb.25.1548630491000; Sun, 27 Jan 2019 15:08:11 -0800 (PST) X-Received: by 2002:a37:61cd:: with SMTP id v196mr17796068qkb.25.1548630490866; Sun, 27 Jan 2019 15:08:10 -0800 (PST) Received: from turing-police.cc.vt.edu ([2601:5c0:c001:4341::936]) by smtp.gmail.com with ESMTPSA id w184sm97215556qkw.90.2019.01.27.15.08.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Jan 2019 15:08:09 -0800 (PST) From: valdis.kletnieks@vt.edu X-Google-Original-From: Valdis.Kletnieks@vt.edu X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7+dev To: Bharath Vedartham cc: 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 In-reply-to: <20190124142755.GA31059@bhar.linux> References: <20190124142755.GA31059@bhar.linux> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 27 Jan 2019 18:08:36 -0500 Message-ID: <17314.1548630516@turing-police.cc.vt.edu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 Jan 2019 19:58:00 +0530, Bharath Vedartham said: > add code to handle the case when kzalloc fails to allocate memory to dev > > Signed-off-by: Bharath Vedartham > dev_set_name(&dev->dev, "iio:device%d", dev->id); > INIT_LIST_HEAD(&dev->buffer_list); > + } else { > + return NULL; > } > > return dev; Not needed, as the 'if (dev)' statement fails, dev is already null.