Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2370041ybz; Sat, 18 Apr 2020 23:30:07 -0700 (PDT) X-Google-Smtp-Source: APiQypJ4mXKEy9vsbebZtzWlWxgTiiqyCIGFB204QpaeKJd6ZFi9mmumHymGoDCx4TXsr8bYbxij X-Received: by 2002:aa7:d689:: with SMTP id d9mr6697576edr.22.1587277806994; Sat, 18 Apr 2020 23:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587277806; cv=none; d=google.com; s=arc-20160816; b=iwxlGjGwNRR6iWfmeGWBFHZrJWjISTu1x6PNne11ZyQ08ayGFIxZZcsub/NhtAtjfe JOlIMi3v27H/0yzhHlnK111ThgO9cv5mFPv7SYQ2od0CkASor3B2eOipJ0FQ/lA+UXro bbnAWe5mL6YX1c8NvaJ25fSnoTlmY49lHstB5eTfHCdVj4olYX4m8vvVPbBEjjTibd9V p0XoaVklWyrkx46qayFl+HfZxVUryzjvSaPOkhwhaLINmiJP68TjA/j5xTFA6TPh/amK QKf+NJ0J3aAq8NwNoNxOGF8jJ6FdU4DbqyIMYgrzZTeCGZUcCxrHvyMPYNmIp7Otkzbx 6srA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=wBX4KEg6wvLw0Zp3d1wBMdJ9QGQPHOUZLi1ZERHRQ0c=; b=RMcWCtE6EgblbWqRy/N0ztZrFJZaPicqmnkXnmAdKD3MOq6f3O4pOrYkIHLPj3WJfi Gu68SLQXlFFAh1iulP1Mh1d9y1OO+OehNL7aESfqLlsfMP4OwGy9PaF4Emb7Zr9fC6+T UpQEhQE1fK6WD3YRgxZ/RocdqOmQ6Rd3l7msNqspuniS9V5uXGwpI1EaWDEJpFqH6xB5 sSKdJKpLMusa9oldolr43IeBJcB3jZTmHqPIneYP7/mvbGqeuVnRzB//oHbfEitvz/F9 CYY5Bz/yZavcANgQnS6SAx2NqYeVCvApXsi78vjKWkU3DqKVZ98KiKqzvjWnATDGRsPq lJHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du12si149199ejc.498.2020.04.18.23.29.42; Sat, 18 Apr 2020 23:30:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725988AbgDSG1n (ORCPT + 99 others); Sun, 19 Apr 2020 02:27:43 -0400 Received: from cmccmta3.chinamobile.com ([221.176.66.81]:5122 "EHLO cmccmta3.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725446AbgDSG1n (ORCPT ); Sun, 19 Apr 2020 02:27:43 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.19]) by rmmx-syy-dmz-app12-12012 (RichMail) with SMTP id 2eec5e9bef4f983-b7bd1; Sun, 19 Apr 2020 14:27:29 +0800 (CST) X-RM-TRANSID: 2eec5e9bef4f983-b7bd1 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from [192.168.0.105] (unknown[112.1.172.61]) by rmsmtp-syy-appsvr10-12010 (RichMail) with SMTP id 2eea5e9bef4fd6a-f5185; Sun, 19 Apr 2020 14:27:28 +0800 (CST) X-RM-TRANSID: 2eea5e9bef4fd6a-f5185 Subject: Re: [PATCH v2] ipmi:bt-bmc: Fix error handling and status check To: minyard@acm.org Cc: arnd@arndb.de, gregkh@linuxfoundation.org, openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <20200418080228.19028-1-tangbin@cmss.chinamobile.com> <20200418134909.GF6246@minyard.net> From: Tang Bin Message-ID: Date: Sun, 19 Apr 2020 14:29:26 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200418134909.GF6246@minyard.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Corey: On 2020/4/18 21:49, Corey Minyard wrote: > On Sat, Apr 18, 2020 at 04:02:29PM +0800, Tang Bin wrote: >> If the function platform_get_irq() failed, the negative >> value returned will not be detected here. So fix error >> handling in bt_bmc_config_irq(). And if devm_request_irq() >> failed, 'bt_bmc->irq' is assigned to zero maybe redundant, >> it may be more suitable for using the correct negative values >> to make the status check in the function bt_bmc_remove(). > You need to mention changing platform_get_irq to > platform_get_irq_optional in the header. > > Another comment inline below. > > Otherwise, this looks good. Got it. The v3 will be as follows: If the function platform_get_irq() failed, the negative value returned will not be detected here. So fix error handling in bt_bmc_config_irq(). And in the function bt_bmc_probe(), when get irq failed, it will print error message. So use platform_get_irq_optional() to simplify code. Finally in the function bt_bmc_remove() should make the right status check if get irq failed. > > You need to set this to rc. Otherwise it will remain the interrupt > number assigned by platform_get_irq_optional(). Yes, I think you are right. I'm not as considerate as you. Thank you for your instruction. When get irq failed, the 'bt_bmc->irq' is negative; when request irq failed, the 'bt_bmc->irq = 0' is right. So 'bt_bmc->irq <= 0' means irq failed. Now let me rearrange the logic here:     In bt_bmc_probe():         bt_bmc_config_irq(bt_bmc, pdev);         if (bt_bmc->irq > 0) {         }     In bt_bmc_remove():         if (bt_bmc->irq <= 0)             del_timer_sync(&bt_bmc->poll_timer); If you think this logic is correct, I'll submit v3. Thanks, Tang Bin > > > >