Message ID | Y3CAdCa17WdWDYUa@qemulion |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1559711wru; Sat, 12 Nov 2022 22:01:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf7tTVb7lp1N3joNc8g2wF+hUh4hGOUJB5wirKgsLqXyf9ccnppZ7J5dF+DbNWIs67aX0138 X-Received: by 2002:a63:a47:0:b0:470:30c5:5af with SMTP id z7-20020a630a47000000b0047030c505afmr7802333pgk.259.1668319303016; Sat, 12 Nov 2022 22:01:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668319303; cv=none; d=google.com; s=arc-20160816; b=mSwKenFfOY3qYjpMJJM+3FM1wCpxrUmMzW+nBhrc2/hg/gfGUlf/JO/OCXd9b4LUOu Yp1Q95mOMwndGK1d9XoRVIwm+FOcXOKSGw8Vo0g99MNTb39zAQKNUhJ1tWQnV3+ewsut v3OiZH1M4wcLapTnrsVzCqXqbtT38qiMUd1eonnGL6zYx72lprG8liLugIoEL9KZxDbg uDpAyabrWkcq0gnOS4D1v3tuejjHT2sPdMIXVNdrbF3t5062hWwheXrbgLmXRtgvzK8N KabDubI2+jP7QJuqz+LEVc3naejGOzGw5JNTefeE0ZZJnqSLTaH3xqdFh77c75LVduEO b4gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date:dkim-signature; bh=B0aTMCaxa5YjMwCMefyNKZm/q3iaDdJEdF3op85MnbY=; b=LUKQmQDwFqpRw5WbaybPQWC3tRpkUzqwQhYiIMiq53qLIIvui3GK18mC68m5j/S0BG YQCnaXw21mgwa2E60MN/mDknODBOOxvRNVgJTXAPAmv7jMpxVMBTN5tNgVpsQyED3KYz nfBNdb50ChUpcBds1hU8t2iedHECU7kz83+Ul9MCTOngl95wYjltKbTuYEkaw8mYgCI9 NkvQ9+p1FDK5ECD8Ufxzfy7+hHBV6R3dbjBbRWMTSiyUS2+lHpTQIIVyANi3nB0RvnAG ynyuv11KDYBsu3JXY3Nwv++c87zOl7uug+zYvNXcxdjIX4Ae628vQ6G4hi9T4gZep66Y 7ZTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=KOZBBF8Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q19-20020a056a00089300b00562331a3562si7265961pfj.130.2022.11.12.22.01.24; Sat, 12 Nov 2022 22:01:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=KOZBBF8Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235195AbiKMF3R (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Sun, 13 Nov 2022 00:29:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbiKMF3P (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 13 Nov 2022 00:29:15 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EDE9EE1B; Sat, 12 Nov 2022 21:29:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1668317305; bh=EeFml0IaVh7+u5qnzQtagdJSc1KAvZBsWOHbyeOYNx4=; h=X-EA-Auth:Date:From:To:Subject:Message-ID:MIME-Version: Content-Type; b=KOZBBF8ZzyP8+Adcy+qOLOZzOlkxrcXlV/1gn5tau/R9wVfOoUJwBjMBw4dgrF8Xy FNBEvwDrkBjBBI5ROCWMnrzzG0hUM/5ObBfQIBD1sRz7bUIX+qmBm+77nacecf3XSG s5xjE/VaNHnLq42LOGys6eFaIvs9F6g+emXjAzkc= Received: by b-6.in.mailobj.net [192.168.90.16] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sun, 13 Nov 2022 06:28:25 +0100 (CET) X-EA-Auth: V2uAWhgOqEgUOklpFT9QYQ6PeJWA+huKz/8ufkfSmKApy7VUb1qN+/MMT5P9VdXiAkkpb7O+rZRnkB5ETyQ03u9943HdS/7G Date: Sun, 13 Nov 2022 10:58:20 +0530 From: Deepak R Varma <drv@mailo.com> To: Lars-Peter Clausen <lars@metafoo.de>, Michael Hennerich <Michael.Hennerich@analog.com>, Jonathan Cameron <jic23@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-iio@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2] staging: iio: meter: replace ternary operator by if condition Message-ID: <Y3CAdCa17WdWDYUa@qemulion> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749359581486595176?= X-GMAIL-MSGID: =?utf-8?q?1749359581486595176?= |
Series |
[v2] staging: iio: meter: replace ternary operator by if condition
|
|
Commit Message
Deepak R Varma
Nov. 13, 2022, 5:28 a.m. UTC
Replace ternary operator by simple if based evaluation of the return
value. Issue identified using coccicheck.
Signed-off-by: Deepak R Varma <drv@mailo.com>
---
Changes in v2:
1. Use if based evaluation instead of using min macro
suggested by Joe Perches.
drivers/staging/iio/meter/ade7854-i2c.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--
2.34.1
Comments
On Sun, 13 Nov 2022 10:58:20 +0530 Deepak R Varma <drv@mailo.com> wrote: > Replace ternary operator by simple if based evaluation of the return > value. Issue identified using coccicheck. > > Signed-off-by: Deepak R Varma <drv@mailo.com> Applied to the togreg branch of iio.git and pushed out as testing to see if 0-day can find anything we missed. Thanks, Jonathan > --- > > Changes in v2: > 1. Use if based evaluation instead of using min macro > suggested by Joe Perches. > > > drivers/staging/iio/meter/ade7854-i2c.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c > index a9a06e8dda51..71b67dd3c8e9 100644 > --- a/drivers/staging/iio/meter/ade7854-i2c.c > +++ b/drivers/staging/iio/meter/ade7854-i2c.c > @@ -61,7 +61,10 @@ static int ade7854_i2c_write_reg(struct device *dev, > unlock: > mutex_unlock(&st->buf_lock); > > - return ret < 0 ? ret : 0; > + if (ret < 0) > + return ret; > + > + return 0; > } > > static int ade7854_i2c_read_reg(struct device *dev, > -- > 2.34.1 > > >
diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c index a9a06e8dda51..71b67dd3c8e9 100644 --- a/drivers/staging/iio/meter/ade7854-i2c.c +++ b/drivers/staging/iio/meter/ade7854-i2c.c @@ -61,7 +61,10 @@ static int ade7854_i2c_write_reg(struct device *dev, unlock: mutex_unlock(&st->buf_lock); - return ret < 0 ? ret : 0; + if (ret < 0) + return ret; + + return 0; } static int ade7854_i2c_read_reg(struct device *dev,