From patchwork Mon Nov 7 04:10:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 16233 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1825308wru; Sun, 6 Nov 2022 20:22:11 -0800 (PST) X-Google-Smtp-Source: AMsMyM6dcjLR+yHZNeM4Pw6oCgwcP7GezD51ljnACA5JNpIOUPs3VdJeypc8k8LaN7x5kOWjn/ZC X-Received: by 2002:a17:907:31c4:b0:78d:9b2f:4e1a with SMTP id xf4-20020a17090731c400b0078d9b2f4e1amr45514951ejb.306.1667794931166; Sun, 06 Nov 2022 20:22:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667794931; cv=none; d=google.com; s=arc-20160816; b=adTXoKozuq277HzWM6XKjnBPJJu5y3V7Fnlzn6ucQc3CJdFrW4q7FyNP0Ke/if4Hk3 NpSBrHE4Y5bLIU0yIJ/TC8AYG4tZEPYhqG+wCYj/Pc05CXPpyw6tQY8X62NftSwAvo16 L6vgNCT3hx6JrR27zKfEAgnJQR7HwRls5MVgsQ2kJNhh15E8BixqM1GSP5OUgglIf0BZ rfgC6AE7IQVviF+zKlqpuXcgFO5OjorAKDjkX6cSW42XAVW3tOp+pGs4Db2Y90vqYXpn R1UYsB5RScjWT0Jj3AgexBcutQJlTpvffv+PlH6USk1ziZSYQBGaweWSE+2g9SQoNrvM Oihw== 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=mzdRwK+FDf9QKdejktZw8mC4DlPBcS6LU1aafD6I2jU=; b=RKWnQNKD6ukwxlYwgSdpU2QutvHX9Fyn65ElaZ2w4fv6fvucHjLugmgvLnDQzoVRGc GYhXtM4lcnx47KT+zHoQJRVDXV20ALD5WQ53mSBdKwPobyTTkij5EvI4mfz6QGAvvIir s/0NKxMl3103NGuBgIslvpbLEFb00bnL4/N+rz4e7ntm872nhgkPY4YstwD7P0I4kE3S 8S8gp1fxQPhUOeo7bkomwERl9st1lJ/WPjPins5SgQuqlizgsqCKAW/9cPLsmc6Y2ZTa oB+ilLcTnCKK99zWH2KXB7K90zDvfDqmuIsMHeh9y2PVRrxS8YV5wQ1+OzeYCXeqvfwX +mSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=C9iFnW7R; 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 n10-20020a50cc4a000000b00463ba265d95si7169208edi.392.2022.11.06.20.21.42; Sun, 06 Nov 2022 20:22:11 -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=C9iFnW7R; 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 S230434AbiKGEKf (ORCPT + 99 others); Sun, 6 Nov 2022 23:10:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230239AbiKGEKc (ORCPT ); Sun, 6 Nov 2022 23:10:32 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE3FEC742; Sun, 6 Nov 2022 20:10:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1667794206; bh=4vpubAxBJPLICHSVHvPCZgQDNFOK73r6037oLcqxRNw=; h=X-EA-Auth:Date:From:To:Subject:Message-ID:MIME-Version: Content-Type; b=C9iFnW7RbBKdhCtxtXzOLa3JlnRrnJ7VcaqFqQVVR90dK9DJVByEiltrZ1pYEHdXW HaZ8FnufHYDVsG2dFR2FWw551lYOjE8LaT6/W7ah0A/HFTvl89M+WhaAXckJee0i1y ThqaZvQWeOJGzQDG1BwXvTM7OKTLYLbeKpByI7oE= Received: by b-4.in.mailobj.net [192.168.90.14] with ESMTP via ip-206.mailobj.net [213.182.55.206] Mon, 7 Nov 2022 05:10:06 +0100 (CET) X-EA-Auth: xmv0Uzdl1lJntsxK/BrE7s8F1LLtHp58aHBwFEduoB5F/pQe89jIg2LygmBdI/VKxLWHU6Cnupv4LfA4oPG2e08H69d/mTW0 Date: Mon, 7 Nov 2022 09:40:00 +0530 From: Deepak R Varma To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Greg Kroah-Hartman , linux-iio@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] staging: iio: meter: use min() for comparison and assignment Message-ID: MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748809737254803747?= X-GMAIL-MSGID: =?utf-8?q?1748809737254803747?= Simplify code by using recommended min helper macro for logical evaluation and value assignment. This issue is identified by coccicheck using the minmax.cocci file. Signed-off-by: Deepak R Varma --- drivers/staging/iio/meter/ade7854-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.34.1 diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c index a9a06e8dda51..a6ce7b24cc8f 100644 --- a/drivers/staging/iio/meter/ade7854-i2c.c +++ b/drivers/staging/iio/meter/ade7854-i2c.c @@ -61,7 +61,7 @@ static int ade7854_i2c_write_reg(struct device *dev, unlock: mutex_unlock(&st->buf_lock); - return ret < 0 ? ret : 0; + return min(ret, 0); } static int ade7854_i2c_read_reg(struct device *dev,