Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp600157rwj; Sat, 29 Oct 2022 08:00:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6inj9FAOFm54ImKUZxtdO/PeVaAohZely4Z/dfwzlil4W31X6BTX9hUw8V7f7vgjV8ERmn X-Received: by 2002:a17:906:7944:b0:73c:838:ac3d with SMTP id l4-20020a170906794400b0073c0838ac3dmr4158323ejo.242.1667055618874; Sat, 29 Oct 2022 08:00:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667055618; cv=none; d=google.com; s=arc-20160816; b=Kf2+yCYEQ3jXscNSZC4GOb+NqbyZClbvOGx+Q8xjTHsu5OIN7xstKR+vhIigGDazG2 SjhraKhESnenetvITvQPbnRYj3BixooOhx/qLRvjNjBhweZC3mFU7ypq2VFGSE6Z3BaT xD9WsaZquWI2WaHZh6KAZx5HXswZtNdlU0sCI7dIsM9z0lngGxuHaP2mgGZ3jpCn2DkV esEcABjjTwWXvAA32IlhROVtl9wTfjy2/dsv/SyAWn2e5TVKLG/UoYQvi+HPfbLW0a8N UT5KE4YUrETqe4fGV5XWbjLm5PPHG1HfYSC/U9qrSSp2b8FKwHsGvXYsvqJjnN0ntx0B XeLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=5xjCglw2m9/QtPixIrMn3Gh7mk7VYuFBE4ssTVT1T4E=; b=fWZ1vEQykeS1SGQEuNVgSM6NnVTGf78PuwiMlvSmameeoPL/A6AKVixUiCoz4cthYe XgTdd0RqMcAgZl+ra5Re2ohTVgGYPrABKzFRZB3IyLX97TMUPDr624kLf4J2HLiavJXg lUaUUYzbGBhlicIgewSSVZ+0S8PTAL+arpNF2Kx/LLcHuZNBGJtaQa0Hp7HZLd2kNq14 s05AZ7GULG4Hx0xjAhspdNvazMvVpBhpxSI5YswRx+FdvW//qWn1LTf35Me0ZZoLpQvI YlNxeqs8ANNK4yPiOeoXJ9c4fL5HgeHJT7tH4Afw5Y/CF4AvNOJ93YPVX150OTaGCXUM Ousw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o18-20020a509b12000000b0044e987f3a34si1767929edi.489.2022.10.29.07.59.53; Sat, 29 Oct 2022 08:00:18 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229782AbiJ2OiS convert rfc822-to-8bit (ORCPT + 99 others); Sat, 29 Oct 2022 10:38:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229565AbiJ2OiR (ORCPT ); Sat, 29 Oct 2022 10:38:17 -0400 Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E3416CD0B for ; Sat, 29 Oct 2022 07:38:16 -0700 (PDT) Received: from omf12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 783E3C0110; Sat, 29 Oct 2022 14:38:14 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf12.hostedemail.com (Postfix) with ESMTPA id DCF0717; Sat, 29 Oct 2022 14:37:55 +0000 (UTC) Message-ID: Subject: Re: [PATCH] Remove Unnecessary typecast of c90 int constant From: Joe Perches To: Julia Lawall , UMWARI JOVIAL Cc: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, outreachy@lists.linux.dev Date: Sat, 29 Oct 2022 07:38:10 -0700 In-Reply-To: References: <20221028063711.GA35659@rdm> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Rspamd-Queue-Id: DCF0717 X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_NONE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Stat-Signature: 3kpugo777z3hb3xfdrd5mryxt7uasajh X-Rspamd-Server: rspamout02 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX18BJ6iGaBQ/gDxUl5GMVObh7DN5jwxKBPo= X-HE-Tag: 1667054275-197456 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 On Fri, 2022-10-28 at 09:22 +0200, Julia Lawall wrote: > > On Fri, 28 Oct 2022, UMWARI JOVIAL wrote: > > > According to Linux kernel coding style. > > > > Reported by checkpatch: > > WARNING: Unnecessary typecast of c90 int constant - '(int)2.412e8' could be '2.412e8' > > WARNING: Unnecessary typecast of c90 int constant - '(int)2.487e8' could be '2.487e8' > > It's not ideal to just include the checkpatch messges verbatim in your log > message. It woudl be better to say what you are doing and why, in > complete sentences ("According to the Linux coding style" is not a > complete sentence). > > I also suspect that the checkpatch message is wrong. Floating point > numbers cannot be used in the kernel, and the case of the constant ensures > that the value will be converted to an integer at compile time. Yes, it's a checkpatch defect. checkpatch should have this: --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 4e187202e77a6..9958a774efaf1 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6758,7 +6759,8 @@ sub process { } # check for cast of C90 native int or longer types constants - if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/) { + if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/ && + $2 !~ /^$Float$/) { my $cast = $1; my $const = $2; my $suffix = "";