Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3339641ybz; Mon, 4 May 2020 00:45:40 -0700 (PDT) X-Google-Smtp-Source: APiQypKSM9J7fffusmymdc+KfSB5a7n47xSshXqRV+uHiFhhM12H2chP7BFuMbvwWQoDSiMzHsKM X-Received: by 2002:a17:906:3796:: with SMTP id n22mr13211207ejc.225.1588578340338; Mon, 04 May 2020 00:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588578340; cv=none; d=google.com; s=arc-20160816; b=hwcWLhEsIfWFAdapOTz6IW7SZbG8y0CmfjLk5T6I68z/L/O9DynRnA8UJuntK5bRUl XXiSKYxCvDGOZ8YVooh721LliaC0xkID1IpIhLx7+AZwFkqWsA6G/7hJnQIcbmdFjdMz ytbMUpPYcXucCz6l4cAQzcRFrabnjVxZPBCJaS4JeAWKJEgKhB8Pyu46hH64IJ7+2O5f Z1xrlntT+8MuXIaz0lr5rehXX1Bsvhu3NuugfSv0eXUopGnMCcbj8blgEyr6mP06b5W9 6W4QRrfYDgxpGirAs2GQmbRQIiKwP4f4rafXQinJl0ilHnfuMCzg7rvZNVF4AYnM+nWX R4DA== 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:references:cc:to:from:subject; bh=ESLr+WCPxWyHRXPFXJDjmEgbyHrE+3pxdqQtUatlqec=; b=oVwOkZAkZPHi7MCIPhRumQueXrVUUy62rb5qk2EKI3lwXAiqUh6GKoOqnIUNPIF0HO MkGm05GL2siXhqaIWcQ3HA4OzH29TPkxAPTflhaRI/SLjqHuPeCaczARbLJo5bJ6PoFB Zn6U/bRdgA+G5V4baFXjsFbNXdSg02ocMHFWIRwc5IGeR8A/5MTKqejLXL8n2FanpfdP 7N/7MX3S3AY0Hzgy2sMIP540+X11jHOGUEwSkRx5plUNlou+qM7JIaOWAWBr+NsnBDu3 KPa8Z3d2CobVeGO4MlzFUqWpLzduMT86ORAIKxe26oumzJ3ji6h2OJTwfXS1bE5xUN/e nkgw== 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 a11si6304657edv.573.2020.05.04.00.45.17; Mon, 04 May 2020 00:45:40 -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 S1728057AbgEDHn3 (ORCPT + 99 others); Mon, 4 May 2020 03:43:29 -0400 Received: from cmccmta3.chinamobile.com ([221.176.66.81]:5143 "EHLO cmccmta3.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727088AbgEDHn3 (ORCPT ); Mon, 4 May 2020 03:43:29 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.7]) by rmmx-syy-dmz-app12-12012 (RichMail) with SMTP id 2eec5eafc78e469-fd873; Mon, 04 May 2020 15:43:10 +0800 (CST) X-RM-TRANSID: 2eec5eafc78e469-fd873 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from [192.168.0.104] (unknown[112.3.182.180]) by rmsmtp-syy-appsvr04-12004 (RichMail) with SMTP id 2ee45eafc78d502-c2b00; Mon, 04 May 2020 15:43:10 +0800 (CST) X-RM-TRANSID: 2ee45eafc78d502-c2b00 Subject: Re: [PATCH v2] ipmi:bt-bmc: Fix error handling and status check From: Tang Bin 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> Message-ID: <45cddef3-eb69-bcff-3b0f-0d7f8e69f0a4@cmss.chinamobile.com> Date: Mon, 4 May 2020 15:43:52 +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: 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/19 14:29, Tang Bin wrote: > 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. > > > I know you're very busy, and you have handed me a lot before, so I should wait for your reply. But I don't know whether my above logic is correct, so I take the liberty to write this email to you. I just wanted to say sorry for disturbing you. Thanks, Tang Bin