From patchwork Fri May 3 22:15:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Melissa Wen X-Patchwork-Id: 10929347 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DAAA613AD for ; Fri, 3 May 2019 22:15:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA1EF287DA for ; Fri, 3 May 2019 22:15:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEC5F287DE; Fri, 3 May 2019 22:15: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,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 60D1F287DB for ; Fri, 3 May 2019 22:15:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726480AbfECWPj (ORCPT ); Fri, 3 May 2019 18:15:39 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:46693 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726042AbfECWPj (ORCPT ); Fri, 3 May 2019 18:15:39 -0400 Received: by mail-qt1-f193.google.com with SMTP id i31so8488515qti.13; Fri, 03 May 2019 15:15:39 -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=SAG93eFHh+qaETzoOcFQNdt8rlclJfMfJCEB5tyPneU=; b=cxRMJufioKVdvfnJKfWHBXy6aUljGfxrLWnsauz+050JKcWB0haJPWdy0XJ3iBvW+Y svO5sSi08Sbc+rOJkObJqDwPph9vSPQoyflUwSt0ZOcbeJH+atKZxoZ98zBxY2qN5IOv hucZoLfhj7xtykRJhiwXWK0vJ/5+0weq/mTzoE3Ge591qXyOnsAZVAjWOmD+bN7/2Edf UmPQZ2hQLydG6WVM6AoQUCqxxX0MAMCzsLSVBTjh9qgRM5CEjzfi1eWBTauTms96wQDO QmL0grDYx7346Ad4PNAtBT/X4o4OIyE5ifb0K7zHfKV3qGvKn280hfiVDyQ5Sz7TWpy1 j4qg== 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=SAG93eFHh+qaETzoOcFQNdt8rlclJfMfJCEB5tyPneU=; b=FUc0vbkkYd+HbHIXpJajzCHgJ0uyFdUt9iMRO+55azxgFpWb9loAA4lJHkmhvinalB d28VQn8bDMx4RCr38VApmhhlCp8DNQycd2YyZ0pQeORmc7CDKm8GKlems3g4k+M+rnI8 aQltGCKyUiVgd3Xlg/k+8Ofdz2TYdzYgxyQf53cGFFFPURVvYbvMB/ke7M9B7QyJjzhZ y46ncjdYtI3pg1cj0T+PiIVNC9B5BP5eFZ9r7Njp8kC0dgiSY77QCC8T1jJ7sNrT3LKp RzYxYHMYxYcft77W1/fUHD7Mtvw3v2eqh4SzbMWw08q12djQQdXk0rObXLsmtHr/DNZH +rjA== X-Gm-Message-State: APjAAAUgSN36s81bADPjO8hz94DK+M6TGYojs+d3uFmlfCwErALhPZ56 boJdEydhrZIISG3vumfLBHM= X-Google-Smtp-Source: APXvYqwN3xXPr46LsBvXQoeM3xNHTgtquMHHKh1QvdRhT3+X053Z7iIDcWI/TfvRozWj41FcfVP6LA== X-Received: by 2002:a0c:92af:: with SMTP id b44mr4193122qvb.141.1556921738622; Fri, 03 May 2019 15:15:38 -0700 (PDT) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id t26sm1807490qkm.82.2019.05.03.15.15.34 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 03 May 2019 15:15:37 -0700 (PDT) Date: Fri, 3 May 2019 19:15:25 -0300 From: Melissa Wen To: Lars-Peter Clausen , Michael Hennerich , Stefan Popa , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , Barry Song <21cnbao@gmail.com> Cc: linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com Subject: [PATCH 3/4] staging: iio: ad7150: simplify i2c SMBus return treatment Message-ID: <18725f7ddc3ac42b1c781b1848b05fabd4bd8320.1556919363.git.melissa.srw@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 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 Since i2c_smbus_write_byte_data returns no-positive value, this commit making the treatment of its return value less verbose. Signed-off-by: Melissa Wen --- drivers/staging/iio/cdc/ad7150.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c index 4ba46fb6ac02..3a4572a9e5ec 100644 --- a/drivers/staging/iio/cdc/ad7150.c +++ b/drivers/staging/iio/cdc/ad7150.c @@ -201,16 +201,12 @@ static int ad7150_write_event_params(struct iio_dev *indio_dev, ret = i2c_smbus_write_byte_data(chip->client, ad7150_addresses[chan][4], sens); - if (ret < 0) + if (ret) return ret; - - ret = i2c_smbus_write_byte_data(chip->client, + else + return i2c_smbus_write_byte_data(chip->client, ad7150_addresses[chan][5], timeout); - if (ret < 0) - return ret; - - return 0; } static int ad7150_write_event_config(struct iio_dev *indio_dev,