From patchwork Tue May 30 11:05:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9754315 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 00EBF602B9 for ; Tue, 30 May 2017 11:20:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E82941FE85 for ; Tue, 30 May 2017 11:20:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD0A227CEA; Tue, 30 May 2017 11:20:43 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7BA731FE85 for ; Tue, 30 May 2017 11:20:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=3pieGUbfnxbc8VzjAUMkhe5ASNZpc0MzaOgVZTTLhIY=; b=mGY iotKpeGEXsCLu/vjkU6JU0ZmfQY8djUt53D25bZYF3V9ncOPq/UHghWd1QZq5AoJAUqJXZ1dOhhrw 8vxMXYYnbZu4ctrwVEPtxwhuhssBb2di0DSNY9YAYgF6LCDdwWayFCD70vGFlDsLRyd7j5twRL61C Xfm8lPm+GzpLf/1nRa1lIzwUSyjHmEsgLzgaXt+uSkJHb3B0hTQnsoEEJ4FubA+ksU4tbKb3Rbu2D VlvfgHk0xErJCkoX2k3LaY5bn1tFSDqJef63FVG+rraVTHL2HgdUOkDCRlMtCsSNwe8W2syHi/+cg +06gEN5HPBKqnrRiVTIv5Y4NmYeTwdA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dFfCb-0004Qv-C6; Tue, 30 May 2017 11:20:41 +0000 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dFeyN-0003xK-Lq for linux-arm-kernel@lists.infradead.org; Tue, 30 May 2017 11:06:01 +0000 Received: by mail-pf0-x243.google.com with SMTP id n23so17132418pfb.3 for ; Tue, 30 May 2017 04:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=J8jfxmiFPkxeV9XhilReH/5MIV92VAlc8Np8eV625TY=; b=r5kEUFgC30uwyj/LnhZOzUtOqWmThQN6PuPB66y8BjlL7IZowSNXGpNdzOSkPg1eNo yQlSGB3DSEn/ImSwzqkb/DgK4M/kdoN4L5gymZD4A+GqT+CRexy4T+pQpXMkg5VREkh4 CNFZ4jBWEGAWNXpf5HzKckYkzq/vp5BS5nG6BBibvadO838WO7c8vQy3BcLomBAYyWdN gwiBhob7lWT1kCdXlgYDCnzVm1uBkQwIxr+etA9I+/B7toBxvJZJOI1T5LRnv3Pfx35Y xEd+wFtBQn18lyBfbmUHZIUj/q4fIlyh27rDJKeDRtDfvwoSb5pBT7BoAi2Z+T6YuAi/ LTWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=J8jfxmiFPkxeV9XhilReH/5MIV92VAlc8Np8eV625TY=; b=sdPgr1DsWUfhQoz1Ii9F4EHIu5NyFKBNDtCzpw6iGL8ffnGzXfNkohGVd6LGi24PT6 jOgVcH+xnFWBAdfSFvFPaz8CIaPGJm6RGJbLfkoWV7W4/yWsgaxMaPQBcGatVgsNTTA2 1GxAJPRdEBzEa8LyXruujOD73W2j2g7E/yHrRHvZxujZkksTSf557WONCrdeyZu9KGXE MdDUYJmCh2xlc56K+RSDHPnvBKlAKxoTbUz9opvYlIcyt+mqGOdEcSGknL6iwkpMA6V0 OCxWhA9SrEEHCxEuK3IAzGU3hZ1aN4MTPXhmyeNK7zt7qW4W9NZvfYMMeO3Qpy/gKGeS ma7w== X-Gm-Message-State: AODbwcBgQoapVIxDLkDIBIyvzK8pqVXZrLakMBjGlyxJGyh8jpleKUW9 T5x7yVJ7kmqTeA== X-Received: by 10.84.164.106 with SMTP id m39mr25859752plg.58.1496142338771; Tue, 30 May 2017 04:05:38 -0700 (PDT) Received: from symbol-HP-Z420-Workstation.zebra.lan ([223.31.70.102]) by smtp.googlemail.com with ESMTPSA id r21sm22612129pfg.95.2017.05.30.04.05.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 May 2017 04:05:37 -0700 (PDT) From: Arvind Yadav To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, vz@mleia.com, slemieux.tyco@gmail.com Subject: [PATCH] iio:adc:lpc32xx Handle return value of clk_prepare_enable Date: Tue, 30 May 2017 16:35:27 +0530 Message-Id: X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170530_040559_814191_1593B449 X-CRM114-Status: GOOD ( 11.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- drivers/iio/adc/lpc32xx_adc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/lpc32xx_adc.c b/drivers/iio/adc/lpc32xx_adc.c index 0de709b..6a5b9a9 100644 --- a/drivers/iio/adc/lpc32xx_adc.c +++ b/drivers/iio/adc/lpc32xx_adc.c @@ -76,10 +76,14 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev, long mask) { struct lpc32xx_adc_state *st = iio_priv(indio_dev); - + int ret; if (mask == IIO_CHAN_INFO_RAW) { mutex_lock(&indio_dev->mlock); - clk_prepare_enable(st->clk); + ret = clk_prepare_enable(st->clk); + if (ret) { + mutex_unlock(&indio_dev->mlock); + return ret; + } /* Measurement setup */ __raw_writel(LPC32XXAD_INTERNAL | (chan->address) | LPC32XXAD_REFp | LPC32XXAD_REFm,