Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2301928pxp; Mon, 21 Mar 2022 16:20:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQ3Mx4gLJtfHBXXXPDsZHNrvj7RNKa722r77nWPbCBSf17EFuA5m7Hnz/G4Zp/sQKbt+YF X-Received: by 2002:a63:2f41:0:b0:382:26ba:8855 with SMTP id v62-20020a632f41000000b0038226ba8855mr15332190pgv.310.1647904801415; Mon, 21 Mar 2022 16:20:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647904801; cv=none; d=google.com; s=arc-20160816; b=RWTFJWHzBFlsvNf+kcLksaEQIK6BaH1UWLWcBwrdIrxLnWnbNbMHx4YylnkKmMZFV9 QwFAH43eJzlHlRnhh9oAsUeFZRBbPecqsbS82ffDeLN8V4tKS5L7K/Bc86VI5XooHCEW dAQYP061Q05hmN74X6wU0C3xPTwk2PutDdj5g+HVZfFXFrJQ0WJn0QqPdziPd6eyoHE1 sC76ekNEvVfurhoNdWudUR4Zumsl5gpUlddIvhO8iFQ+b1awZDdj9FfxoI4Ci3Dcdvzp Lik1+gdl0HvYSNX6s1jaNNEzdz+iBbGmjMFJf728dopbZtr7bFUmY2ECdJ1/+qJeQdhq SB0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=f5otBo1VwpvjuYLVlfpGc/yO89ULi5ckUWY9vKxKxxs=; b=FpjxsYL1k/8oh36mqOHQeY91lrAwXULxeBoGHXk33fv1PFjuwnNwNbs1zzrAmIZXPN YoNDe7fth9qI1XFU0fkIZj76T9W9SfXsTeLn1pVWTbdue0rG+rqOx+C00wMVVRRcpVKo c0K/NXkm8qvEZmh+bh0yUC2NvDWPXUr/uXKO/JWfpukcygoEg/ESlqAygbEL9k3bgUL6 rnDD/ZLa4r/EKCcZGVl2D4ZGeW/2CEWCVfiSiuwqccpA3pmiTPIDXcaHRKUFUI7iONKB StaV6MtOirkN1dLUipPKZcnOplrFE8YD6wLD1ZR73xm3pLuY/A7zmrfEE0rrjNiN1dRa myMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DR1QgoQY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q18-20020a170902b11200b00153b2d1657dsi406205plr.389.2022.03.21.16.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:20:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DR1QgoQY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 00C6746303C; Mon, 21 Mar 2022 15:19:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346858AbiCUL5C (ORCPT + 99 others); Mon, 21 Mar 2022 07:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235298AbiCUL5A (ORCPT ); Mon, 21 Mar 2022 07:57:00 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FAD210F4; Mon, 21 Mar 2022 04:55:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647863736; x=1679399736; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mfbOq5iAK8SE23byJMRPvctNFXZ1aD5KZOZcb0LP44M=; b=DR1QgoQYQrVhL1OfDhk99/W8xfaqNFPlazz/dykZD0GDkIJP93wqzIhD awC3UUtM1nrB+iLWH8RAW7VsU70EeuA5y666w5PP8IPduIHVTuOZ/Lq4v vPhiXw64yvg9LFdBQQMyxtahGPMbB1ssPT+FigKb5NbuAnYLDpafsdSe6 TzM/MuRBjZ9XfdKcI+0/syGuWjKuBPaNBoW8dymp01Nsx11Gwq8aiEImB M/2KOBzcR+c0XgO1ZR2uTq2MrDtlvKX2SoeLTMEVfthg873xrjvMzYeUr o7s+fnBZYYE5GF7RR9c2MAAwjHBC3waxYtMopoW+hyO5ewQNcA7Oodq9D g==; X-IronPort-AV: E=McAfee;i="6200,9189,10292"; a="237475047" X-IronPort-AV: E=Sophos;i="5.90,198,1643702400"; d="scan'208";a="237475047" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2022 04:55:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,198,1643702400"; d="scan'208";a="692147795" Received: from irvmail001.ir.intel.com ([10.43.11.63]) by fmsmga001.fm.intel.com with ESMTP; 21 Mar 2022 04:55:33 -0700 Received: from newjersey.igk.intel.com (newjersey.igk.intel.com [10.102.20.203]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 22LBtV4B012712; Mon, 21 Mar 2022 11:55:31 GMT From: Alexander Lobakin To: Wan Jiabing Cc: Alexander Lobakin , Tony Nguyen , Jesse Brandeburg , "David S. Miller" , "Jakub Kicinski" , Paolo Abeni , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [Intel-wired-lan] [PATCH] ice: use min() to make code cleaner in ice_gnss Date: Mon, 21 Mar 2022 12:54:11 +0100 Message-Id: <20220321115412.844440-1-alexandr.lobakin@intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <8822dfa2-bdb8-fceb-e920-94afb50881e8@intel.com> References: <20220318094629.526321-1-wanjiabing@vivo.com> <8822dfa2-bdb8-fceb-e920-94afb50881e8@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Tony Nguyen Date: Fri, 18 Mar 2022 13:19:26 -0700 > On 3/18/2022 2:46 AM, Wan Jiabing wrote: Hey Wan, > > Fix the following coccicheck warning: > > ./drivers/net/ethernet/intel/ice/ice_gnss.c:79:26-27: WARNING opportunity for min() > > > > Use min() to make code cleaner. > > > > Signed-off-by: Wan Jiabing > > There are build issues with this patch: > > In file included from ./include/linux/kernel.h:26, > from drivers/net/ethernet/intel/ice/ice.h:9, > from drivers/net/ethernet/intel/ice/ice_gnss.c:4: > drivers/net/ethernet/intel/ice/ice_gnss.c: In function 'ice_gnss_read': > ./include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast [-Werror] > 20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) > | ^~ > ./include/linux/minmax.h:26:18: note: in expansion of macro '__typecheck' > 26 | (__typecheck(x, y) && __no_side_effects(x, y)) > | ^~~~~~~~~~~ > ./include/linux/minmax.h:36:31: note: in expansion of macro '__safe_cmp' > 36 | __builtin_choose_expr(__safe_cmp(x, y), \ > | ^~~~~~~~~~ > ./include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp' > 45 | #define min(x, y) __careful_cmp(x, y, <) > | ^~~~~~~~~~~~~ > drivers/net/ethernet/intel/ice/ice_gnss.c:79:30: note: in expansion of macro 'min' > 79 | bytes_read = min(bytes_left, ICE_MAX_I2C_DATA_SIZE); > | ^~~ Use `min_t(typeof(bytes_left), ICE_MAX_I2C_DATA_SIZE)` to avoid this. Plain definitions are usually treated as `unsigned long` unless there's a suffix (u, ull etc.). > cc1: all warnings being treated as errors Thanks, Al