Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1674237rwi; Thu, 3 Nov 2022 07:55:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5svLcicO5GNpJCwfxIrGquzfv8vYEd0XvklPOqRwHA/AQdup/32D1Y1aFsQlZEpuPk9jD1 X-Received: by 2002:a17:907:7da6:b0:791:997e:58fc with SMTP id oz38-20020a1709077da600b00791997e58fcmr30046859ejc.385.1667487310568; Thu, 03 Nov 2022 07:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667487310; cv=none; d=google.com; s=arc-20160816; b=f+HJx6pwxwBbNIbgQn3EKhdxEbEnNDR7vpp3ArrvjX6/y0TQxAbc4YQr0fM6hVNRU7 RwcOSqWBeGQq122r0oGljedT+NZS078VM2AbKRJKMzdcdGYZZSubdNhwNZuf5FwGFp6M rX2gxZLPujIadChOU4Q+J5kD4va7EgU5H8wsqmdj7VbLhZGB4IWERXvtbxyHVKaeR6De snA3/LN3TjWRqabe/jXHy1AtZIEVXZ22xv36d/CxRfwz1RMUnHJHPg8CuJbAyV6D0Xab AV/DMMT4A3K62nCyy+mrzsxqca//EHCYeoIpMRZmDDeAshOL4zI5XV9txpIuT4JnXmnF yqQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=EitdsXRzGfmz+XIYSw7ljKU8CMo4715fYNhm2adSG7o=; b=UuT8qvgD/TLiTFr0CA/dObiLzmdBBE7Bxf60O96Nyt9GdhQgUpeyrOrJxoGlEcRTwo d2rCFNvv38ePuxt0CmONYyCxDRi9UMu+sCW2j+bk1eWMrIm4UU2RbVLDCQ+mBZAtTkM8 Dp+35JZVD57QTKVHOS6HGKxt+SDgKmNQG4e2ZZZefCnVnctKAcTHQo8r7ozxQRXuDNMo LKUsM3aFnuLfxCu5ViPHcnzq6B+UK8gXHHFcOajLXfgzvGXxXJnROvdNanwxduhWptuN G5+E1dnp0uDp8UW+SL/IxHCpY7woLFyi5IAU2qN1LsXBFMT/k4sue9Alx3DpuVzoJiCf QWrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qfL+gTMB; 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 g8-20020a056402180800b00461d60a86casi1482213edy.135.2022.11.03.07.54.47; Thu, 03 Nov 2022 07:55:10 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qfL+gTMB; 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 S231491AbiKCOTM (ORCPT + 97 others); Thu, 3 Nov 2022 10:19:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbiKCOSM (ORCPT ); Thu, 3 Nov 2022 10:18:12 -0400 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51FAE14D0C; Thu, 3 Nov 2022 07:17:31 -0700 (PDT) Received: by mail-ot1-x330.google.com with SMTP id cb2-20020a056830618200b00661b6e5dcd8so1038264otb.8; Thu, 03 Nov 2022 07:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=EitdsXRzGfmz+XIYSw7ljKU8CMo4715fYNhm2adSG7o=; b=qfL+gTMBfj9E6+znXpMuosKwDB/HLPxIByRas7WxKQa1SEf0zb/vRtwfFEi33tuFyy RsKOYtLImap/odkSiyZ9dMAUIH8gARsid8XZZDLAZIXG7QYrUnIXuLJC3a1/0KoegZy1 8OG/CaMpkCdIcCfGkM3xJsZJfotymqavlv2beRkE6Yn2/YQStgI/+YhNOgZ5YPZJcNyc 26nHz4QnyOr9PEsfUuLc7mK1YCzStX7ClDzR4+tmIq3Jqn+B9FTbFGTdUf7bxMUOUcn8 bDoQw898KeDv0oJHA/XA3+5tjPdrr8rwIcktKba7+1h3QNrnJi1BPyyRVVnBY809Dtxp z4TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EitdsXRzGfmz+XIYSw7ljKU8CMo4715fYNhm2adSG7o=; b=6j66W1Tc5YJfZEUxE+jySvHNTGSnUczy/DEJuBzr18EY0I8gUCnf/muzGSrQcdQ7q+ 4WtcnjokkWrSCOtCjC3qifTtRfLJCpOMSa7D0jPs9MAJO5GqUwr6JKzCDgdzOwD/yd7v 4fQYT+DSCeystG+vuDgMRXHUfIzMEC5j/x11gWD44vhrF3PM6j9hhJAEug0w7YWMdPyb EKdA1xjGdHWkxm0cb+1E3uaN5qCHP2Pj4iuiUvlT4R5oEvTi+yXzWuJ7fjQFvGsCdj5C OfRKe1bDxhGrqGEquSpLzMuN0l8FJy2V7PgNhVour5cCtDgM/My7wA1Z0LSKxYCxg8ck VsVQ== X-Gm-Message-State: ACrzQf0j3b2mRtbKryTqNJpzdiwhEt0SiI72RU46FatxCfsX6WSMCSU6 a13XlZ2pcnssewmu5Nw5IXzUTKF9aoA= X-Received: by 2002:a9d:60ca:0:b0:66c:30e4:9297 with SMTP id b10-20020a9d60ca000000b0066c30e49297mr15191196otk.150.1667485050636; Thu, 03 Nov 2022 07:17:30 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id q143-20020a4a3395000000b0048fb9b6dd70sm279884ooq.0.2022.11.03.07.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 07:17:29 -0700 (PDT) Sender: Guenter Roeck Date: Thu, 3 Nov 2022 07:17:27 -0700 From: Guenter Roeck To: Randy Dunlap Cc: wangkailong@jari.cn, jdelvare@suse.com, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] hwmon: (amc6821) Fix unsigned expression compared with zero Message-ID: <20221103141727.GA145042@roeck-us.net> References: <1872639a.89.1843b5106aa.Coremail.wangkailong@jari.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 On Wed, Nov 02, 2022 at 07:59:06PM -0700, Randy Dunlap wrote: > > > On 11/2/22 19:27, wangkailong@jari.cn wrote: > > Fix the following coccicheck warning: > > > > drivers/hwmon/amc6821.c:215: WARNING: Unsigned expression compared > > with zero: reg > 0 > > drivers/hwmon/amc6821.c:228: WARNING: Unsigned expression compared > > with zero: reg > 0 > > > > Signed-off-by: KaiLong Wang > > Hm. IDGI. What's wrong with comparing an unsigned value to > 0? > I mean, it could be == 0 or > 0. > Please explain. I don't get it either. The real problem with this driver is that error returns from i2c functions are not checked. However, that problem is not fixed by this patch. That means the patch would change behavior without fixing the actual problem. I wonder what kind of (broken) compiler or analyzer produces above errors. We'll have to watch out for similar broken "fixes". Guenter