public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: Tang Bin <tangbin@cmss.chinamobile.com>
Cc: arnd@arndb.de, gregkh@linuxfoundation.org,
	openipmi-developer@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ipmi:bt-bmc: Fix error handling and status check
Date: Mon, 4 May 2020 08:16:05 -0500	[thread overview]
Message-ID: <20200504131605.GJ9902@minyard.net> (raw)
In-Reply-To: <cc048630-831d-9765-7f7a-7eaacd3a8199@cmss.chinamobile.com>

On Sun, Apr 19, 2020 at 02:29:26PM +0800, 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.

Sorry, I missed your question here and was waiting for v3.

Well, we want bt_bmc->irq < 0 to mean the irq request failed.

> 
> Now let me rearrange the logic here:
> 
>     In bt_bmc_probe():
> 
>         bt_bmc_config_irq(bt_bmc, pdev);
> 
>         if (bt_bmc->irq > 0) {

Should be >= 0.

> 
>         }
> 
> 
>     In bt_bmc_remove():
> 
>         if (bt_bmc->irq <= 0)
>             del_timer_sync(&bt_bmc->poll_timer);

Should be < 0.  But other than that, I think it's correct.

-corey

> 
> 
> If you think this logic is correct, I'll submit v3.
> 
> Thanks,
> 
> Tang Bin
> 
> > 
> > 
> > 
> > 
> 
> 

      parent reply	other threads:[~2020-05-04 13:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-18  8:02 [PATCH v2] ipmi:bt-bmc: Fix error handling and status check Tang Bin
2020-04-18 13:49 ` Corey Minyard
2020-04-19  6:29   ` Tang Bin
2020-05-04  7:43     ` Tang Bin
2020-05-04 13:16     ` Corey Minyard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200504131605.GJ9902@minyard.net \
    --to=minyard@acm.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=tangbin@cmss.chinamobile.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox