Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2918726rdg; Mon, 16 Oct 2023 21:15:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5Vv+vV2sDtatmd9UyQmEzQ765bB7mU2sSOLiZDbzmwiEovV/0t3RRRiHYuPcYMJf+2/1q X-Received: by 2002:a05:6808:19a:b0:3ad:9c16:aa94 with SMTP id w26-20020a056808019a00b003ad9c16aa94mr1326845oic.33.1697516113234; Mon, 16 Oct 2023 21:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697516113; cv=none; d=google.com; s=arc-20160816; b=aMoB4knJ604kny6oZJ/KGL3MuRn4FoumyHjzUE2gyMAGEfDsUsRglSG0WiLSiQci4E T2NWckGrXHH9P0DZ8eXV5y5TDTB/9OuUN10GY2za76AoIio8odkthYcLS6sgd8cBjVhq VSNsCFlU4LE4+1uNYy+SBKxG793QOe6Jbu/Eq/wsSZ9J0wHIUVrJdQTwzQMVUpAYGDbm gHmucSYE9HQ+35PxzRusdXybrd5OVy/f5+qPSM67WJL1oYK+JUEsBV7vpzbXhGlPgtWC +BXMl+KezQ3ZAWwpNfNvwFmuD4eELQhvBJtKzlUv28DEAzbblFuID5gS5/gH3GHSRiHF sUZA== 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:dkim-signature; bh=q2dZBUmwthCKe42eGQqfFVlklrGhflMnlew3Rp0hoTg=; fh=BoxB2Ry29Zq8LKA5LZ1qH6PLly0zD6xCtsBZdTNRXys=; b=xjJTvUgwfLffeiCqldlbQPPPak0QyG1LQnpkDxnrn01kn8/nD5PdFRqXKtn6MgdesT xPxAHmyMa1wIPBAvuYyqvOw5XcgxjkecImjM6f+0RaT6XPeTVV9/CbAiXcdIYzA5cqr1 XHMvwaaliEr0zYZX7WM5sUSYnzTXgKqD44MPStxyLn9jB2GQd9dL6cre6y7PU4Q3b7YW /+1fHFbz3GAcUQFd/9a/2VXrWpaMQawXXeO5BuRKa7wujIJgFgIbq4whKxLnKx+7n7IU LWyLlPSe4zGuMQsnA53f9b3wcqtgud+U4REE15fDpAAtQ5Tabo11kQGNU7a0kJIQqtpr NlsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y4KfdR7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id u4-20020a656704000000b005b7c45c3cabsi873635pgf.857.2023.10.16.21.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 21:15:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y4KfdR7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 39A908032ED6; Mon, 16 Oct 2023 21:15:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234086AbjJQEOz (ORCPT + 99 others); Tue, 17 Oct 2023 00:14:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbjJQEOx (ORCPT ); Tue, 17 Oct 2023 00:14:53 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51F2E83 for ; Mon, 16 Oct 2023 21:14:52 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-323ef9a8b59so5017835f8f.3 for ; Mon, 16 Oct 2023 21:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697516090; x=1698120890; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=q2dZBUmwthCKe42eGQqfFVlklrGhflMnlew3Rp0hoTg=; b=Y4KfdR7BHSAD8ergWl9zJFZjW/kHu4yTFRsS9Hmo5lQ7ch0xtSpz5iP7CRHiK417Hd jzhFW/Bi2r05CVSx5PjLKo5KMRlR95fpTpuID5yXZONkC6BfFixackSCNCJb3ZTsx+Zb ldkmQrjUYpB4HZMR6eumiAOOa/pCEE6Vr8B/m5oyHzmFvXJws5nETbIPz4fz8FHBiU1m IQs0ibJoXB7+GioetWB6rKiqSNGNOfhTGOXJMf/T5F+ZFYU1lBPtocpaemKYgT+T5oM4 wg/VLsM5HzEE3tEB3WvoVxePv+uk1eq85nwTmUNZhLZVF3LNn8I54QpLehriVhtRAnSb Z+Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697516090; x=1698120890; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=q2dZBUmwthCKe42eGQqfFVlklrGhflMnlew3Rp0hoTg=; b=gT7v79OD8lGwwqwikFvGMLpLeh1c6ARdjL/6hGHWblojSVX3rDUTzG+fap3REXKvIw EP5t+6zuVVp+7AD6pOYgxNkDdpi12Mniwlqja6njoT5ScgFS/NQZHwXHX9Wjz57WBZiD BTm1c8a9lVQop1a6UP5svCRlOsXkIwK3vykmfO8MjBKyo3utdXf5X1ljn+oVYsv5JXgR iuOvmonAFIUYOOplt8a4kxraKbMTBgOSq6Q3ReDdXM5+ZC+nDjXswSPu3/IzSnv6V0U4 LSpk+W5zaG+WYsuYBUe52l6AQaVcs6H28c2bX6BLhZSzPQmCD2l5ve5raesNLgfXY+Nn rgug== X-Gm-Message-State: AOJu0YyCOPj5DvIrj1vj1gItKQMTwx748EAdzTmdAw7+n2Rd+9b8zFjk aqonhtb2CAg8q7rdLYUk1ISb+g== X-Received: by 2002:a5d:6186:0:b0:32d:9d3d:8b98 with SMTP id j6-20020a5d6186000000b0032d9d3d8b98mr1034563wru.71.1697516090540; Mon, 16 Oct 2023 21:14:50 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id e13-20020adfef0d000000b0032d9caeab0fsm686370wro.77.2023.10.16.21.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 21:14:50 -0700 (PDT) Date: Tue, 17 Oct 2023 07:14:47 +0300 From: Dan Carpenter To: Andi Shyti Cc: Greg KH , Gilbert Adikankwu , outreachy@lists.linux.dev, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: emxx_udc: Remove unnecessary parentheses around condition tests Message-ID: <8de0c0ea-d81c-402a-a5c4-7779a190c306@kadam.mountain> References: <2023101658-unmoral-survival-25cf@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 16 Oct 2023 21:15:11 -0700 (PDT) On Mon, Oct 16, 2023 at 11:27:03PM +0200, Andi Shyti wrote: > > > Fix 47 warnings detected by checkpatch.pl about unnecessary parenthesis > > > around condition tests. > > > > And as I have stated numerous times in the past, they are not > > "unnecessary" at all, and provide a valuable hint to the developer as to > > what is the ordering involved. > > > > So you can ignore this checkpatch warning please, it's not valid as far > > as I'm concerned for the subsystems that I maintain in the kernel. > > I find this very confusing, though: > > if (((ep->epnum == 0) || (data & (1 << ep->epnum)) == 0)) Yeah. Too many parens. It could hide an == vs = bug. (That happened once 10 years ago but I still remember it as if it were a useful and dangerous anti-pattern to remember instead of a getting hit by a meteor type thing that will never happen again). Also == 0 should only be used for the number zero (used as a number and not as a logical no or absence) and for strcmp() functions. if ((ep->epnum == 0) || !(data & (1 << ep->epnum))) regards, dan carpenter