From patchwork Wed Mar 14 18:12:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10283205 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 89EBA602BD for ; Wed, 14 Mar 2018 18:12:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 792E320952 for ; Wed, 14 Mar 2018 18:12:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D97322376; Wed, 14 Mar 2018 18:12:56 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 1B22020952 for ; Wed, 14 Mar 2018 18:12:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752323AbeCNSMm (ORCPT ); Wed, 14 Mar 2018 14:12:42 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:34574 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751478AbeCNSMX (ORCPT ); Wed, 14 Mar 2018 14:12:23 -0400 Received: by mail-qt0-f194.google.com with SMTP id l25so4476376qtj.1; Wed, 14 Mar 2018 11:12:23 -0700 (PDT) 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=QG59QrkLho7gsPX+kq8f8LOlamM+NJA9FnGP2KvNQaY=; b=UlnXQc2pkZm0vfKd5FJiqRHXw1M6mT4roMOp4O+47nFix7L9A03tuKa8X5ADFoYpIN QiN6MDGEPksDflx7W8Wyv11CeiOF29WovewigUxeDT3nuijQr8FkvZMmwjnyyYbNEtj0 ZmwM7IP+0WWK+QryYNcYhSFFsY8mOjAlgnJOwcTM/mT7KoJAJ73B7XSuruZvu1ABcJZ0 0yJoA1bTH00XTTtpjzPR0QUxzkpAR1wu8WcUvtaIvRP/Kg8FPS+lXMHAKrhNkukJwNy8 M11SRyVuRVWUYes9Pzr7ZqOzjAqmDBd1/Fxw6uAb3DzCKrdZlaSeP+m7oMqWvVafNXP7 ZhRw== 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=QG59QrkLho7gsPX+kq8f8LOlamM+NJA9FnGP2KvNQaY=; b=mtSjygrzOZZ7ANaC7yWzRCGBN4l0M0U/lWGv9cxfy2vOjKEG73pMvR56EiOX1RH/y2 e0JH01vfQuWLFF8VfjuKt+kDnToHgoQQfWclz04OngNE27t6krmo+GNYSoqA75qSjf8J lDnVAeK3jnr1oDwLmcyuGcAAwtqmdWAYYThBy3WqFEZqenLVuu90t/S0QZZopAII8HsG jy6HVhrkMQEAt/Rf2m6Yc/E8U87uOlBzottyFTEbqtsPQNTFWRX0xkRJUOFgKE4C4FO7 t827qHGmNE46ndOOFRf1clwQygO9lVguUTUbJ653BZA1nNGJQF2wjFqir7NIWNAwnmwL E8eQ== X-Gm-Message-State: AElRT7GV/rgtQeU53N+TJI083pvHMiFLioYKIyFpYAAHXAJoO4qtAgtV 14Crt5qXzUiGV41O4u0SsMU= X-Google-Smtp-Source: AG47ELvf6MtTPDYurd+EsK8Ga92zBOesTYi2aKRZgnMWPfEZqRfQat6xh0juG9cRglnuEcfT8o5mug== X-Received: by 10.237.61.145 with SMTP id i17mr8094919qtf.293.1521051142526; Wed, 14 Mar 2018 11:12:22 -0700 (PDT) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id x30sm2359199qtm.13.2018.03.14.11.12.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Mar 2018 11:12:21 -0700 (PDT) Date: Wed, 14 Mar 2018 15:12:18 -0300 From: Rodrigo Siqueira To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Greg Kroah-Hartman , Barry Song <21cnbao@gmail.com>, John Syne Cc: daniel.baluta@nxp.com, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] staging:iio:ade7854: Add proper error handling condition Message-ID: <72d5aaef3445edaca08498b4d7aaff19d4ac0232.1521037060.git.rodrigosiqueiramelo@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180223 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 There is some improper error handling for IRQ and device register. This patch adds a proper verification. The IRQ correction was extracted from John Syne patches. Signed-off-by: Rodrigo Siqueira Signed-off-by: John Syne --- drivers/staging/iio/meter/ade7854.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/iio/meter/ade7854.c b/drivers/staging/iio/meter/ade7854.c index 09fd8c067738..49cbe365e43d 100644 --- a/drivers/staging/iio/meter/ade7854.c +++ b/drivers/staging/iio/meter/ade7854.c @@ -436,7 +436,7 @@ static int ade7854_initial_setup(struct iio_dev *indio_dev) /* Disable IRQ */ ret = ade7854_set_irq(dev, false); - if (ret) { + if (ret < 0) { dev_err(dev, "disable irq failed"); goto err_ret; } @@ -544,7 +544,7 @@ int ade7854_probe(struct iio_dev *indio_dev, struct device *dev) indio_dev->modes = INDIO_DIRECT_MODE; ret = devm_iio_device_register(dev, indio_dev); - if (ret) + if (ret < 0) return ret; /* Get the device into a sane initial state */