From patchwork Sat Jan 28 10:39:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 49841 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1283074wrn; Sat, 28 Jan 2023 02:42:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXv24eOHAcwXUjXZrNf/PNC4AY3Md50gq3qPps5Bdbkcs5UFOo8SiXqew2gXdITslP0RHztA X-Received: by 2002:a17:90a:ba11:b0:229:ab5e:e123 with SMTP id s17-20020a17090aba1100b00229ab5ee123mr42998484pjr.40.1674902553190; Sat, 28 Jan 2023 02:42:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674902553; cv=none; d=google.com; s=arc-20160816; b=btQXB3MQNJELVFHlRPObyuebrop2zQ25iMUggMbU03GrfC+Vi3XZPVjGeL8lKRvnxW V2bUWnPwKnpQ54N7DQzUK3tBI/gvJTj6qsbRBL5WSKWpsMB8xBvf5B51YusaSaXBEQLi cFzDHFgFVdopiBGlU9r8WFY3F2mVn69DQX6PJJjMJXYA32j3XpwyH8H8rpLBxfg5jeof X5ck/KR1Z9DOlhT6kt1bGGldKgbvsiBeeYAUh7xbJqLEAgyTq9lOW+wPPTwSUw2/fDbA hBGR3S9UmteTrlzAZngwmjveubImSYdcknCXgNKfsCliUWLGoDoMEPTkRA4axhyMuf6b x83g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dbTALqihWfVDpbxG9iAs371OZDuVG+s/GnKY1VON8g4=; b=yS+orDNFNovyP1OuxLKGzZ3860XtzuGExkKoRUwJx44u1UvpgFBdlSXA9PxHGyAN9v OFLhC0T5zEKHRAv8XLlnkz1/kts7AqXGYT+e7UHpU9tmCmCp/O4Mg0PstBtm+fS5O5xb 7qsN86k4tylXqFuXJgCM/OxtnC0RriftGSpDEbPaSH0nbzDYgRdaVtA/nA+utWk7CJ5b vWqGcrMn0k0Xzewofa30BnUcpjNlFOIGQtLfpoT2pp34/EmsiPkcTSqx9VluB3n5VVbD O7PHVl7h0ahklrNvl0SS/W6BGoaExbxhFF3REAvP9A0vexnW1wUu8OpB7aYFVhtHnLRt Yfxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=k6QEnyHn; 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 w11-20020a17090a380b00b0022bb7ca5bc0si6973653pjb.151.2023.01.28.02.42.21; Sat, 28 Jan 2023 02:42:33 -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=k6QEnyHn; 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 S234122AbjA1Kj2 (ORCPT + 99 others); Sat, 28 Jan 2023 05:39:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233571AbjA1Kj0 (ORCPT ); Sat, 28 Jan 2023 05:39:26 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F7E3757A6; Sat, 28 Jan 2023 02:39:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1674902355; bh=i3OVujB4KLVLDGE0Fr7EASyJveRKF8eT3d88+y3e42w=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=k6QEnyHntZuXRepVb90tckWffNAsE19Pnp9R3YxkmC58SuOj/CaifC1L0UBO+Woqw HCuS6EcEAiikiZ7Ztux4YzDcfPBRrsoglnFCys0t/V+TD+IYzrjGbqQyFXrnfi1KkS 8UuOnApWBBKjMqVRAEQPwKiX2E8waTyRLx2UkAnM= Received: by b-5.in.mailobj.net [192.168.90.15] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 28 Jan 2023 11:39:15 +0100 (CET) X-EA-Auth: Fkf8d9ReBXPysJCalcJ1P5bj+NmJgnDSYDgXM1qvVwLxgjBD7WlxvtIXncnpveDpm/aoiai542S/zZt3qW3gUtfrDgSjIbFZ Date: Sat, 28 Jan 2023 16:09:11 +0530 From: Deepak R Varma To: Kashyap Desai , Sumit Saxena , Shivasharan S , "James E.J. Bottomley" , "Martin K. Petersen" , megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: [PATCH 1/2] scsi: megaraid: Use max helper for comparison and assignment Message-ID: <9db7d3932ac03616f181dabaa53d0b37efb30914.1674900575.git.drv@mailo.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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?1756262619592362935?= X-GMAIL-MSGID: =?utf-8?q?1756262619592362935?= Simplify code using max() helper macro for logical evaluation and value assignment. Proposed change is identified using minmax.cocci semantic patch script. Signed-off-by: Deepak R Varma --- drivers/scsi/megaraid.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index bf491af9f0d6..c9600e395c34 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -3473,8 +3473,7 @@ mega_m_to_n(void __user *arg, nitioctl_t *uioc) /* * Choose the xferlen bigger of input and output data */ - uioc->xferlen = uioc_mimd.outlen > uioc_mimd.inlen ? - uioc_mimd.outlen : uioc_mimd.inlen; + uioc->xferlen = max(uioc_mimd.outlen, uioc_mimd.inlen); if( uioc_mimd.outlen ) uioc->flags = UIOC_RD; if( uioc_mimd.inlen ) uioc->flags |= UIOC_WR;