Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp742420rwl; Sun, 25 Dec 2022 06:20:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXvgf3uUUc/wKUBy+CxvrIIkgqQiinX80OeGf7+r38S95Fwm4KSQhCsgdYnj7FWIcgqf9bhF X-Received: by 2002:a17:902:ce83:b0:189:dc9e:cef3 with SMTP id f3-20020a170902ce8300b00189dc9ecef3mr21821470plg.16.1671978004805; Sun, 25 Dec 2022 06:20:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671978004; cv=none; d=google.com; s=arc-20160816; b=b3HS+2adsJX4nb+6lFZOdHuiY42pkEHfASfC4xiF4rxdHPRSu6iBgSRXi+FYsiqX6d h77slOB0dQ0s5jB3j8Rns/Z7vNH+S5L2sJ+C4GFUukTDg2ZDC7dj0ago5DyuXAKkmy2/ dQ+r4GfZxbbJC/dH8l/R5vmrKJ81s8slYGWkRMRxChlOixy+NuPajkwE5HKl7YKDXEjI SVhF631C5jGZ3+Ydze8AHaX0kM7oVzr4xpU7BvD9LXdCKQ6NyVJ+UtOwekX0QbyovXXE CcKpmgAYJ/5qQViIru1MIPr/6eKvn8Cu6AHVVVRGg1C3kgn0lnHeixkW/yM4Ook9cKlA q3YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=niYqII/y6uSXj/qldxCx5zx8OzKaw3GEXnxBhhCFXOg=; b=PQ2Ga6fofYokL4b0ngEu75G6vAsrMu3rDRXT07gOzFRB0pDFXbx9UFdIlVkRESP/7B WytKzm9FLo3A7EyZ4u5dFMyTJBNd7zFVifV1TbQpDxb1B75fsuKYo/15SX1zHsX5w4KB MWEdTYzXDcK7cBvKGCvqr4dJpPLNFU4nr1TDXiU1AQm8yXU4OrK0dkPv5cTgafwPKfsP r09EhgmvHL9/EzB7heL8iPggP9a/FdxfC1M2Asgu1TTFEh9NQeDkf7Gh/61LT+nYYTcU Jbwq7HrFouzexl+oFcS/XCM0JyxIQGaDtbLAK6d2pXxy9y9BisxlVPtn9Ki/Ms/YnBrJ gPCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20210112 header.b=hmkFiOte; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p17-20020a170902e35100b001892c399f03si8147817plc.365.2022.12.25.06.19.54; Sun, 25 Dec 2022 06:20:04 -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=pass header.i=@googlemail.com header.s=20210112 header.b=hmkFiOte; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229671AbiLYOSt (ORCPT + 67 others); Sun, 25 Dec 2022 09:18:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiLYOSm (ORCPT ); Sun, 25 Dec 2022 09:18:42 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79E4025FC; Sun, 25 Dec 2022 06:18:39 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id m18so21778881eji.5; Sun, 25 Dec 2022 06:18:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=niYqII/y6uSXj/qldxCx5zx8OzKaw3GEXnxBhhCFXOg=; b=hmkFiOteIM1MtZAN0cHoQuZiqcnf1HUhX+/5XHKscPDBWysXzEx6yjvwkqCT5jnowM PvrPbwzBPvbHb7Duwq+31mlctE60unvh+AYNG3f9psbome+U3ET1tloSdSlEiwyYnv2M eC7i4E76F5XZmkmhDJKVPIXRTaEU7Q/03mc1TczUEmsPKcVn26T6Y+D7q+YYUnHp3qp4 ofz3EBf2BUrbH/LYagShvQCAD5BvN4JGWdxOnQncvVhlQD6E8FiSK4UlkmN1kL9ZHsJh yZsAfCtZKNbfoZDOOCEoq8lN0iYr9/TuMRqaAb5mwycy+Hevr5HXQljrAghD4z+9iLdv 8HzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=niYqII/y6uSXj/qldxCx5zx8OzKaw3GEXnxBhhCFXOg=; b=06el0W+4Z/fu/riJ0Vwgv6j1Vha35g0tUzI5bXBN3aXQP98d3FupcTNUdRnexw3VRa v3tpRV2Ti3UT5pYjQEQSplYUyNS5KvlJyQvKptzpeBJdHoXde1070E2jQTHWwPDdEyHA ofozJmrSGEueKD5YYknpg7uImZIAxZRzFZ1qlqOny5fABg/62u6T0TtuWDVR+SiATaBj WkWXz7vGihug9mFjUbAyt/JrgUIap9vBQFcZxUz9+OfpmGHerq8wgl+V4zxkDqpv8Lrb YTJqB8Q8WvkQU6bmqFo1HyPqj3dB0D49SfiQuZSFUWEtL7lJE3IszPi6EkfPdELXbEKH Bhqg== X-Gm-Message-State: AFqh2krI4PAm4OV8ara8F2fMpJjQ2RPg/JjR48uPy7YN6xx4TvCEBzRL 2MbZ+UVhqcoz3YYFddHXpbXvv9Ft90xh+COBCHD2erF8 X-Received: by 2002:a17:906:3989:b0:7c1:1f28:afed with SMTP id h9-20020a170906398900b007c11f28afedmr1265191eje.678.1671977917920; Sun, 25 Dec 2022 06:18:37 -0800 (PST) MIME-Version: 1.0 References: <202212222251.Xacx8c4D-lkp@intel.com> <20221222234148.GA2776378@roeck-us.net> In-Reply-To: <20221222234148.GA2776378@roeck-us.net> From: Martin Blumenstingl Date: Sun, 25 Dec 2022 15:18:27 +0100 Message-ID: Subject: Re: drivers/hwmon/jc42.c:477 jc42_readable_reg() warn: always true condition '(reg >= 0) => (0-u32max >= 0)' To: Guenter Roeck Cc: kernel test robot , oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Hi Guenter, On Fri, Dec 23, 2022 at 12:41 AM Guenter Roeck wrote: > > On Thu, Dec 22, 2022 at 10:20:13PM +0100, Martin Blumenstingl wrote: > > Hi Guenter et al., > > > > On Thu, Dec 22, 2022 at 3:36 PM kernel test robot wrote: > > [...] > > > 475 static bool jc42_readable_reg(struct device *dev, unsigned int reg) > > > 476 { > > > > 477 return (reg >= JC42_REG_CAP && reg <= JC42_REG_DEVICEID) || > > > 478 reg == JC42_REG_SMBUS; > > The bot is right: we can omit "reg >= JC42_REG_CAP" as it's already > > covered by the fact that: > > - the reg variable is unsigned, which means the lower limit is zero > > - reg <= JC42_REG_DEVICEID covers the upper limit > > > > Before I send a patch I'd like to hear if removal of "reg >= > > JC42_REG_CAP" makes sense to other people. > > > > The bot keeps complaining about it. Yes, it is technically unnecessary, > but I left it in on purpose to indicate that JC42_REG_CAP is the first > register and that it wasn't forgotten. Any modern C compiler notices > that the check is unnecessary and drops it, so there is no runtime penalty. Thanks for your feedback. Since I had to double check the bot's complaint I'll just keep this as-is (and not send any patch for this at all). > This is one of those situations where I'd like to have a means to tell > the checker to please stop complaining. I see, in some cases this may be an actual logic error (for example: accidentally using an unsigned data type instead of a signed one). Best regards, Martin