Message ID | Y9P8debIztOZXazW@ubun2204.myguest.virtualbox.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;lekhanya01809@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <drv@mailo.com> To: Pali =?iso-8859-1?q?Roh=E1r?= <pali@kernel.org>, Hans de Goede <hdegoede@redhat.com>, Mark Gross <markgross@kernel.org>, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar <ssengar@microsoft.com>, Praveen Kumar <kumarpraveen@linux.microsoft.com> Subject: [PATCH] platform/x86: dell-smo8800: Use min_t() for comparison and assignment Message-ID: <Y9P8debIztOZXazW@ubun2204.myguest.virtualbox.org> 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?1756194699477491429?= X-GMAIL-MSGID: =?utf-8?q?1756194699477491429?= |
Series |
platform/x86: dell-smo8800: Use min_t() for comparison and assignment
|
|
Commit Message
Deepak R Varma
Jan. 27, 2023, 4:31 p.m. UTC
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 <drv@mailo.com>
---
drivers/platform/x86/dell/dell-smo8800.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
Comments
On Friday 27 January 2023 22:01:49 Deepak R Varma wrote: > 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 <drv@mailo.com> Looks good, Acked-by: Pali Rohár <pali@kernel.org> > --- > 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; > -- > 2.34.1 > > >
Hi, On 1/27/23 17:31, Deepak R Varma wrote: > 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 <drv@mailo.com> Thank you for your patch, I've applied this patch to my review-hans branch: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while. Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window. Regards, Hans > --- > 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;
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;