From patchwork Fri Jan 27 16:31:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 49490 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp929449wrn; Fri, 27 Jan 2023 08:43:00 -0800 (PST) X-Google-Smtp-Source: AK7set9SiWbL+XlBaI6i5LpwJbqjA3v0Ih7wXrYoJ/7ASZ51zKzhCXHQwFz/UcLM8L4NcHNEcRbk X-Received: by 2002:a62:7b44:0:b0:592:5b20:e61 with SMTP id w65-20020a627b44000000b005925b200e61mr4794671pfc.8.1674837779732; Fri, 27 Jan 2023 08:42:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674837779; cv=none; d=google.com; s=arc-20160816; b=jX+0pTojR1WOHxgd+vs+KFNW9dDhoW0pVDjnyr7S+nmkv+4SWeukCmjXn3+7wdcbUt M0d8at7O+WGJBukf81RPpn1gu+QWabYGHxt8rFkbyp598Lm8BqIIhiOWLvrdFxlXvDmu PfgGIpAYyeZJ0ENG+kGoeYo4OuT3ZT9UQcUSYrBQ3TaBHUpyHJx7ZVWc342yIrFxeFPL enJVgh7OtHxUqpGtlhRcFniImORunoK+iNCJN2YRpyYYZQs3WbJ1X68MR12MMsgdCRjH /7Bl30W6srvV8XIOR9Y2L6Dm3un8rwMhucAD8ks6vONMmotA6l/TqUOcKo+QdgHf8Y+n QOww== 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:cc:to:from:date:dkim-signature; bh=M493C4GlYLhB0YaxGzFiC6mP3Z2+aASd+h0pmWKMUYw=; b=grOrOaVbJi5xR39Wx+SdwIm/qNVCvrjI9kCnoXnDaTqFX9WnfCjKez2N3ijZU3EIkC SQNMc5NF++iGZNjtzpfskTLn8OURQBHcpZJUdDaDeh2QecMPcXzWJGGpl84cz2GtDo50 4A6ZrnRh/cXaDpwvXx+Z8o5ymW/g7Rxs6BrhGPy4E0jlaFJ6k28ENtTKzIngevFW8EvG 4UpSEaAMFIfrl8cp2a6cT9/gHJ1ckq+6VjmJIlyyX9xoUAWj6ekA2D5hA4ushKpEYy6w MkdM9LtD0FUMAwsx/rT2GTknrKoMwZJCPZD4cvFrBK9Kw9uCUQaDjf8LFpeJp4MqMTpe iSWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=SUTL06j6; 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 m129-20020a625887000000b00590569bc56esi4622071pfb.298.2023.01.27.08.42.46; Fri, 27 Jan 2023 08:42:59 -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=SUTL06j6; 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 S234928AbjA0QcM (ORCPT + 99 others); Fri, 27 Jan 2023 11:32:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234340AbjA0QcL (ORCPT ); Fri, 27 Jan 2023 11:32:11 -0500 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5F0F7D6F2; Fri, 27 Jan 2023 08:32:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1674837114; bh=vj4kVhLtQ+dIiXMCosovvjgWH9gdE7UHMs5WyPLi7GM=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=SUTL06j6soeiTZPjxv0txpD3o/EjY67wNH/yoRpD6SnydFK0jB+ijGn95wF/ppfAT 7WotvE+TODNm1WrMOZFHoImjlR520tha+re3AZKNeFKiOI2b6hLsDaXR97nBIpG2Wh at/8inswS960IQ8DxeQcYZ2/COEQLJ5d5Srd98Yc= Received: by b-4.in.mailobj.net [192.168.90.14] with ESMTP via ip-206.mailobj.net [213.182.55.206] Fri, 27 Jan 2023 17:31:54 +0100 (CET) X-EA-Auth: tyf9JgDjzN3rfr5CP8gcpmNTaF1BMh6woDDK9QoGkJQoCiklXKtXjoqg8earvIT8+DO+4t/LrVfQlV1h48bQjnn0vdoq/KMr Date: Fri, 27 Jan 2023 22:01:49 +0530 From: Deepak R Varma To: Pali =?iso-8859-1?q?Roh=E1r?= , Hans de Goede , Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar Subject: [PATCH] platform/x86: dell-smo8800: Use min_t() 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?1756194699477491429?= X-GMAIL-MSGID: =?utf-8?q?1756194699477491429?= Simplify code by using min_t helper macro for logical evaluation and value assignment. Use the _t variant of min macro since the variable types are not same. This issue is identified by coccicheck using the minmax.cocci file. Signed-off-by: Deepak R Varma Acked-by: Pali Rohár --- drivers/platform/x86/dell/dell-smo8800.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/platform/x86/dell/dell-smo8800.c b/drivers/platform/x86/dell/dell-smo8800.c index 3385e852104c..8d6b7a83cf24 100644 --- a/drivers/platform/x86/dell/dell-smo8800.c +++ b/drivers/platform/x86/dell/dell-smo8800.c @@ -67,10 +67,7 @@ static ssize_t smo8800_misc_read(struct file *file, char __user *buf, retval = 1; - if (data < 255) - byte_data = data; - else - byte_data = 255; + byte_data = min_t(u32, data, 255); if (put_user(byte_data, buf)) retval = -EFAULT;