Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5500604rwr; Mon, 24 Apr 2023 05:17:54 -0700 (PDT) X-Google-Smtp-Source: AKy350ZU/KzNBfvvEslvGW7qTOx+wZbnn6U0fmtb4ijxjTg57noncRZjefzGRrq5u8+orPLROUBO X-Received: by 2002:a05:6a20:4303:b0:f0:93d9:9c03 with SMTP id h3-20020a056a20430300b000f093d99c03mr16319191pzk.15.1682338674325; Mon, 24 Apr 2023 05:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682338674; cv=none; d=google.com; s=arc-20160816; b=07Si8djE2xfYq9X66jI5ZXQa8GJ4+Ro2CnLBPl05eFyPttNJoPN+a0xsEgc4pSRULZ H8UZvu6Jp2dL8uZH+SqO6RMQO5XXetQD9MEYHx2qkFMKBDFNOTM/RJ4SUCo7i/p2ZgrF trNkEsPYTjEzdfOP6NpJfwBRH0pJRDCvyD9hJPjkSCr+tYj7IdasF4Xr4HRRIjOzY5lm zgxvfDyKBJshY7t36MkTE3UTVjwxsIkMX0OQJ/Mj7vwFVM4Dk0yU2uJZ/9C3p32z+Qhh maJsBSjFRNee16dHlmqJtatvpsW8EXG5ClhpbGxwnea+Uh8dNBIYdGaDwFX6vYoWqSLW AaAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=4kF8oqmZXIDPBFQ1LYIYT1etKk1LyzwuIfmqmGUHUiQ=; b=fFbbhMYR9iLcYwrvGin9Q7+opqMg/JgSmIIgiV4qVIYCqFpFlnQ6vmF+qp15tAMbCd hzSHwtOja78QsXjaft46HUpMCi2pwseAcmQT4y+pA6AE0pEUZDhOIlfsu9qKPJgmC1UD e5BNMUI3AzJPxIT7BptceuKzL1sYZpLq5mADmxwYT7eRI16MxdvmBS6+mP82c6kqzxTz XKOf778CVriv3+vDzcMsMZilWe4HUg0zGw6qfqonjYO2qXzBtxAOmTPPph4w5A1yqng2 QztC/Zlk4Tm/6es8Vk4AY0C71HabLqAW3A47NsqG6mOgJ44hmGMGiSJfkNAwksiXni0t mW9g== ARC-Authentication-Results: i=1; mx.google.com; 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 v68-20020a626147000000b00639e52424a6si10570021pfb.146.2023.04.24.05.17.36; Mon, 24 Apr 2023 05:17:54 -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; 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 S231617AbjDXMEA (ORCPT + 99 others); Mon, 24 Apr 2023 08:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231360AbjDXMD7 (ORCPT ); Mon, 24 Apr 2023 08:03:59 -0400 Received: from hust.edu.cn (mail.hust.edu.cn [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0463010EA; Mon, 24 Apr 2023 05:03:54 -0700 (PDT) Received: from [IPV6:2001:250:4000:5113:4140:2ad:3e:4b54] ([172.16.0.254]) (user=dzm91@hust.edu.cn mech=PLAIN bits=0) by mx1.hust.edu.cn with ESMTP id 33OC3g4w013596-33OC3g4x013596 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Mon, 24 Apr 2023 20:03:43 +0800 Message-ID: <46299274-d827-279f-cadf-020e93296c13@hust.edu.cn> Date: Mon, 24 Apr 2023 20:03:42 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH] spi: davinci: Remove dead code in `davinci_spi_probe()` To: Mark Brown , Li Ningke Cc: hust-os-kernel-patches@googlegroups.com, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230423032446.34347-1-lnk_01@hust.edu.cn> From: Dongliang Mu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-FEAS-AUTH-USER: dzm91@hust.edu.cn X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 2023/4/24 19:48, Mark Brown wrote: > On Sun, Apr 23, 2023 at 03:24:46AM +0000, Li Ningke wrote: >> Smatch complains that >> drivers/spi/spi-davinci.c:915 davinci_spi_probe() warn: >> platform_get_irq() does not return zero >> >> There is no need to check whether the return value is zero as >> `platform_get_irq()` only returns non-zero IRQ number on success >> or negative error number on failure, removing them to solve this >> problem. > Is that check valid? 0 was a valid interrupt for some architectures... We just follow the comments of platform_get_irq(). /**  * platform_get_irq - get an IRQ for a device  * @dev: platform device  * @num: IRQ number index  *  * Gets an IRQ for a platform device and prints an error message if finding the  * IRQ fails. Device drivers should check the return value for errors so as to  * not pass a negative integer value to the request_irq() APIs.  *  * For example::  *  *              int irq = platform_get_irq(pdev, 0);  *              if (irq < 0)  *                      return irq;  *  * Return: non-zero IRQ number on success, negative error number on failure.  */ int platform_get_irq(struct platform_device *dev, unsigned int num) {         int ret;         ret = platform_get_irq_optional(dev, num);         if (ret < 0)                 return dev_err_probe(&dev->dev, ret,                                      "IRQ index %u not found\n", num);         return ret; }