Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2051148imu; Thu, 24 Jan 2019 06:28:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN6JfoFoR84K5bMrWlPHBpe0JweHcwn+Jyn1UD12GUl5GLgXMIYr6Ym51DtrsLDK8stGQms0 X-Received: by 2002:a17:902:981:: with SMTP id 1mr6618198pln.142.1548340134274; Thu, 24 Jan 2019 06:28:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548340134; cv=none; d=google.com; s=arc-20160816; b=zgEsX05++9nE3MIE7EK7Q2ChUqJ11uHvxfXQkPol1zDX6/Ys1InYP+DxWv8ndBJVSr dINKQnoVwdZtt/tNNyuN+fBVPZAwX9GM0dBqDq40ohUPiOkJ5QzF0R8kIM5aDu8uMsao IyVZ/SIn3BMX6XAQ7JXzlmkB/lIvcwWebGeFyDOH/uG5rNQGpiN+5GOeUvvxPeofZTmD 6eIyBEKvz9u02dABvAhvDTpGBiMJHQpLGzo4qSXgBdpycouWLT+4XZ9hoLUvAIOwRgbg sND7/TqsfZUoVh+XZwAXrv5WoCb4LL/2CdU8HGbp3sIuKiLXvZmGBl9+++QLKLHBs1Wa j0cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=ISfaXsr2H24qrZQzKQBAmGRhlucCPOZ3M80vrtSDgLY=; b=vyhNahlG3hVs0+l9kQg373KoxFJieWGgnrJDNsoghQClhq/Tz3oWNdZbZqrQHBWgCW gd2qsccYGIEcbDkLO2RoLiwkOsTfjllxEIhiPwhIZm6/TZeetwb5cuAK0G701/1ZK4cB HvGBWSY2gY2GrFXC4lCt7skikSg8pVHGXt+OC1qnBGdJCKdXhnREAT7vp4NFWUydcIg4 jgS0WPn2/VBQiQ87mGJSussc5+mFZJ6cZR7aEozelD6IbeyuZyu9AkLAwxG8Xu/YAlYi LkQi0FGlRd28iZkAsDSULK1y7uQCF85KKNegIE4Q5Da1jIkw1sQ+nWjgHM0yVQp2eu2D U7EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mWptCaMC; 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 d34si20846339pgb.43.2019.01.24.06.28.38; Thu, 24 Jan 2019 06:28:54 -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=mWptCaMC; 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 S1728295AbfAXO2H (ORCPT + 99 others); Thu, 24 Jan 2019 09:28:07 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:43765 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728036AbfAXO2G (ORCPT ); Thu, 24 Jan 2019 09:28:06 -0500 Received: by mail-pf1-f193.google.com with SMTP id w73so3052408pfk.10; Thu, 24 Jan 2019 06:28:06 -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:mime-version:content-disposition :user-agent; bh=ISfaXsr2H24qrZQzKQBAmGRhlucCPOZ3M80vrtSDgLY=; b=mWptCaMCN7bd8aR6Hwbj9k8Ot4wLMsQQRTtZnQFmunq+TaS6LbT2kuexHlxbhLTewz FlC7tJ7/Klj0q7Bq7X6hrbgm0gKeL5nGh5ovSsXg441qmJOgvFBsKHOVy2ULAO+XxV/Q v/WpOHQS/bY/F73PFLtCuR3+PDFIAyQqyGP/yGeUgUVqdMyE67sPY699sYYB6LiZ8iQ/ /5JMurrqK2IOEF1I21pR6zm9sjddCK02MBAFvrEhX/dVJGP7atnSIcOJajLoJoc1ujdj 9LSFwNUQaFX2OWXQI/wWkiZCEqXloPRefUdZIWPeBR+HaDcUlfWc2K1lVFGyjjw1wmtN rMmQ== 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:mime-version :content-disposition:user-agent; bh=ISfaXsr2H24qrZQzKQBAmGRhlucCPOZ3M80vrtSDgLY=; b=CKkHbZcFOkAhHba67MrWA5GK/VvvZ6oU0un8ncYA2ZXn/9aMwTz/wAFMTOtmhE20t8 /I1hjhsjRNbZmC69oSAv5/ai+eAsOV4sO2sxAM6o8TUoLg+hzWU3GHZbhVmy50Yr+CPV QmAwAHdhnEhLUQ2/3VUPsHKP7gGp93kWHsxHe25q9Y4b5PiCsaaZgKli2y6XCCe1/AG9 dcFD0MdzqzUfnXRU9ImIEyOECSFs8A21bo5p1DpE5zjVhRuUneoGHJXCKK1dsDOfN/sl hoQD+wUb1gsWg+NTNefVFz5HqnZT4CEEjohwCVkvsVVJmz8zsESHcllQ6pwFVJFsg5TD zfFg== X-Gm-Message-State: AJcUukcfz0bdO9m1X5tzgKEvM6eOQ7Yec7oP18BiU9KZMKQglZyjuxs7 fvQQ/QtUVZ/bsFCo6vEM1U2PNTyF X-Received: by 2002:a62:d148:: with SMTP id t8mr6859659pfl.52.1548340085746; Thu, 24 Jan 2019 06:28:05 -0800 (PST) Received: from bhar12345-VirtualBox ([103.110.42.32]) by smtp.gmail.com with ESMTPSA id o66sm37705825pgo.75.2019.01.24.06.28.04 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 24 Jan 2019 06:28:05 -0800 (PST) Date: Thu, 24 Jan 2019 19:58:00 +0530 From: Bharath Vedartham To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] drivers: iio: industrialio-core: add check when kzalloc fails Message-ID: <20190124142755.GA31059@bhar.linux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } return dev; -- 2.7.4