From patchwork Thu Feb 15 07:19:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Windfeldt-Prytz X-Patchwork-Id: 10220503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0978B601E7 for ; Thu, 15 Feb 2018 07:19:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA2E729068 for ; Thu, 15 Feb 2018 07:19:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE19629077; Thu, 15 Feb 2018 07:19:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16F0E29068 for ; Thu, 15 Feb 2018 07:19:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754823AbeBOHTi (ORCPT ); Thu, 15 Feb 2018 02:19:38 -0500 Received: from bastet.se.axis.com ([195.60.68.11]:49350 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754805AbeBOHTh (ORCPT ); Thu, 15 Feb 2018 02:19:37 -0500 Received: from localhost (localhost [127.0.0.1]) by bastet.se.axis.com (Postfix) with ESMTP id ACF9B1844C; Thu, 15 Feb 2018 08:19:36 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bastet.se.axis.com Received: from bastet.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bastet.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id PDnnq4qcc6dW; Thu, 15 Feb 2018 08:19:36 +0100 (CET) Received: from boulder03.se.axis.com (boulder03.se.axis.com [10.0.8.17]) by bastet.se.axis.com (Postfix) with ESMTPS id C3FA718449; Thu, 15 Feb 2018 08:19:35 +0100 (CET) Received: from boulder03.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A956C1E092; Thu, 15 Feb 2018 08:19:35 +0100 (CET) Received: from boulder03.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D69C1E091; Thu, 15 Feb 2018 08:19:35 +0100 (CET) Received: from thoth.se.axis.com (unknown [10.0.2.173]) by boulder03.se.axis.com (Postfix) with ESMTP; Thu, 15 Feb 2018 08:19:35 +0100 (CET) Received: from lnxstefanw3.se.axis.com (lnxstefanw3.se.axis.com [10.94.15.3]) by thoth.se.axis.com (Postfix) with ESMTP id 90FD7111E; Thu, 15 Feb 2018 08:19:35 +0100 (CET) Received: by lnxstefanw3.se.axis.com (Postfix, from userid 9758) id 8C6BE800A8; Thu, 15 Feb 2018 08:19:35 +0100 (CET) From: Stefan Windfeldt-Prytz To: jic23@kernel.org Cc: knaack.h@gmx.de, lars@metafoo.de, ppmeerw@pmeerw.net, linux-iio@vger.kernel.org, Stefan Windfeldt-Prytz Subject: [PATCH] iio: buffer: check if a buffer has been set up when poll is called Date: Thu, 15 Feb 2018 08:19:18 +0100 Message-Id: <1518679158-16604-1-git-send-email-stefan.windfeldt@axis.com> X-Mailer: git-send-email 2.1.4 X-TM-AS-GCONF: 00 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If no iio buffer has been set up and poll is called return 0. Change-Id: I79809c366e2206cfea6159ff8b0a12a988ee549f Signed-off-by: Stefan Windfeldt-Prytz --- drivers/iio/industrialio-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 79abf70..cd5bfe3 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -175,7 +175,7 @@ __poll_t iio_buffer_poll(struct file *filp, struct iio_dev *indio_dev = filp->private_data; struct iio_buffer *rb = indio_dev->buffer; - if (!indio_dev->info) + if (!indio_dev->info || rb == NULL) return 0; poll_wait(filp, &rb->pollq, wait);