From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 228D5C3DA6E for ; Fri, 16 Dec 2022 21:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229988AbiLPVei (ORCPT ); Fri, 16 Dec 2022 16:34:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230365AbiLPVe0 (ORCPT ); Fri, 16 Dec 2022 16:34:26 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D3426BCAA for ; Fri, 16 Dec 2022 13:34:25 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id z144so1913671iof.3 for ; Fri, 16 Dec 2022 13:34:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=4O3C1ibrA8mqSC/GREIx+zN2+v3HHkAuREG1a+CLcQ4=; b=H/EP0on7htHCxZYiWQiOK0jKfrJuc75EHQPleFDEeDaQAsUoRCLpkOwuqdnYfhMSeU oPuR/DbZ35vNg5rzcj319xHH7kcdrkQsSQHNAD8H0nWxZKpfNCKgcVx8gDqzXgr8qQjO 1dJxg+d8K2mODZ3Wp8LdKrNYUh/W587PAFlFw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4O3C1ibrA8mqSC/GREIx+zN2+v3HHkAuREG1a+CLcQ4=; b=vywTtx6u4zraDsh1FO2eTvaoEhu5fxsB3ZZ3QSAoa3NcV+fWNwp7jqgSvC5FFuJfOE sb3o73OTqO9fuOk/OfQWabPVqGdqnlmXRcD3rrZUZRj75Hv0cviO+oEhfgX73qPJocDI +HL9PSjGkfIx+JYJ4VzmVz5kQ7uB6y+XgmDEsx4qiM/HQKGfQENwPGBr63wMcq/7RFcF ++AWQaXGcwkAmy1XBkca1en5yaRTcUzJFOC/NC4YUEgaMrRiA3LsGsS6XfT8YVVG6wm5 ocir7Zu/dOdZEMd3WECM1OHT6fRsd4IdatVFTfqm6Eu5Urfa7XsT7Rdk3dak7RMYzNoe qkBg== X-Gm-Message-State: AFqh2krS0KYynY/3Mnsr+eiX1A5sClG+X7yXpOXh8FQMmzQtdUovyZnG TMR88Q7uh1YYk9Fg1CyYnsF6sg== X-Google-Smtp-Source: AMrXdXsSzN2a3PWXO43BWzOpWb8gSkDLu5L1nSdXBwFTziUaQLxLMh/aQA3tPIGPT7GVjKRlvlayPA== X-Received: by 2002:a6b:f407:0:b0:6e2:fc7f:13a0 with SMTP id i7-20020a6bf407000000b006e2fc7f13a0mr156704iog.13.1671226464831; Fri, 16 Dec 2022 13:34:24 -0800 (PST) Received: from [172.22.22.4] ([98.61.227.136]) by smtp.googlemail.com with ESMTPSA id p7-20020a02c807000000b003884192cc05sm1056057jao.120.2022.12.16.13.34.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Dec 2022 13:34:24 -0800 (PST) Message-ID: <941d8fa9-9c7b-8e06-e87a-b1c9ed80a639@ieee.org> Date: Fri, 16 Dec 2022 15:34:23 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH net-next v3] net: ipa: Remove redundant comparison with zero Content-Language: en-US To: Kang Minchul , Alex Elder , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221216211124.154459-1-tegongkang@gmail.com> From: Alex Elder In-Reply-To: <20221216211124.154459-1-tegongkang@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/16/22 3:11 PM, Kang Minchul wrote: > platform_get_irq_byname() returns non-zero IRQ number on success, > and negative error number on failure. > > So comparing return value with zero is unnecessary. > > Signed-off-by: Kang Minchul > --- > drivers/net/ipa/gsi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c > index bea2da1c4c51..e05e94bd9ba0 100644 > --- a/drivers/net/ipa/gsi.c > +++ b/drivers/net/ipa/gsi.c > @@ -1302,7 +1302,7 @@ static int gsi_irq_init(struct gsi *gsi, struct platform_device *pdev) > int ret; > > ret = platform_get_irq_byname(pdev, "gsi"); > - if (ret <= 0) > + if (ret < 0) > return ret ? : -EINVAL; In doing this, you assume platform_get_irq_byname() never returns 0. I accept that assumption now. But in that case, ret will *always* be non-zero if the branch is taken, so the next line should simply be: return ret; There are two other places in the IPA driver that follow exactly the same pattern of getting the IRQ number and handling the possibility that the value returned is (erroneously) 0. If you're making this change in one place, please do so in all of them. Frankly though, I think this change adds little value, and I would be content to just leave everything as-is... -Alex > > gsi->irq = ret;