linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomas Henzl <thenzl@redhat.com>
To: emilne@redhat.com, Johannes Thumshirn <jthumshirn@suse.de>
Cc: Insu Yun <wuninsu@gmail.com>,
	nagalakshmi.nandigama@avagotech.com,
	praveen.krishnamoorthy@avagotech.com,
	sreekanth.reddy@avagotech.com, abhijit.mahajan@avagotech.com,
	MPT-FusionLinux.pdl@avagotech.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org, taesoo@gatech.edu,
	yeongjin.jang@gatech.edu, insu@gatech.edu, changwoo@gatech.edu
Subject: Re: [PATCH v2] fusion-mptbase: handle failed allocation for workqueue
Date: Fri, 19 Feb 2016 14:46:25 +0100	[thread overview]
Message-ID: <56C71CB1.9040500@redhat.com> (raw)
In-Reply-To: <1455814515.22112.476.camel@localhost.localdomain>

On 18.2.2016 17:55, Ewan Milne wrote:
> On Thu, 2016-02-18 at 11:40 -0500, Ewan Milne wrote:
>> It also appears to me upon further inspection that the existing code has
>> other problems.  In particular, once mpt_mapresources() has returned
>> with a nonzero error code, it looks like iounmap() should be called, but
>> it is not in the case of a failed allocation of reset_work_q.  I'm also
>> not sure why pci_release_selected_regions() is only called for the case
>> of mpt_do_ioc_recovery() returning != -5 when it is called whenever
>> there is a failed allocation of reset_work_q.
>>
>> Consider the attached patch (untested, because I don't have hardware):
>> It shows what I would do for labels & error handling.  If the rc != -5
>> case of return from mpt_do_ioc_recovery() could be eliminated, then
>> another label "out_free_fw_event_q:" could be added prior to the other
>> error cases at the end, and all the code after the printk() in that path
>> could be replaced by "goto out_free_fw_event_q;"
>>
>> 	if ((r = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP,
>> 	    CAN_SLEEP)) != 0){
>> 		printk(MYIOC_s_ERR_FMT "didn't initialize properly! (%d)\n",
>> 		    ioc->name, r);
>> 		goto out_free_fw_event_q;
>> 	}
>> ...
>>
>> out_free_fw_event_q:
>> 	destroy_workqueue(ioc->fw_event_q);
>> 	ioc->fw_event_q = NULL;
>>
>> out_remove_ioc:
>> ...
>>
>> However I do not know if that change is legitimate.
>>
>> -Ewan
> There is an error in the patch attached in my previous mail.
> Please refer to the attached PATCH v2 RFC.

Looks fine to me, do you we could add this change to your patch ?


diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index a4f362b3b4..4a42c1534c 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -2012,6 +2012,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
                if (ioc->alt_ioc)
                        ioc->alt_ioc->alt_ioc = NULL;
                iounmap(ioc->memmap);
+               if (pci_is_enabled(pdev)
+                       pci_disable_device(pdev);
                if (r != -5)
                        pci_release_selected_regions(pdev, ioc->bars);

@@ -2019,7 +2021,6 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
                ioc->reset_work_q = NULL;

                kfree(ioc);
-               pci_set_drvdata(pdev, NULL);
                return r;
        }

@@ -2052,13 +2053,13 @@ out_remove_ioc:
        list_del(&ioc->list);
        if (ioc->alt_ioc)
                ioc->alt_ioc->alt_ioc = NULL;
-       pci_set_drvdata(ioc->pcidev, NULL);

        destroy_workqueue(ioc->reset_work_q);
        ioc->reset_work_q = NULL;

 out_unmap_resources:
        iounmap(ioc->memmap);
+       pci_disable_device(pdev);
        pci_release_selected_regions(pdev, ioc->bars);

 out_free_ioc:

-tomash

>
> -Ewan
>

      reply	other threads:[~2016-02-19 13:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18  4:40 [PATCH v2] fusion-mptbase: handle failed allocation for workqueue Insu Yun
2016-02-18  9:00 ` Johannes Thumshirn
2016-02-18 16:40   ` Ewan Milne
2016-02-18 16:55     ` Ewan Milne
2016-02-19 13:46       ` Tomas Henzl [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=56C71CB1.9040500@redhat.com \
    --to=thenzl@redhat.com \
    --cc=MPT-FusionLinux.pdl@avagotech.com \
    --cc=abhijit.mahajan@avagotech.com \
    --cc=changwoo@gatech.edu \
    --cc=emilne@redhat.com \
    --cc=insu@gatech.edu \
    --cc=jthumshirn@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nagalakshmi.nandigama@avagotech.com \
    --cc=praveen.krishnamoorthy@avagotech.com \
    --cc=sreekanth.reddy@avagotech.com \
    --cc=taesoo@gatech.edu \
    --cc=wuninsu@gmail.com \
    --cc=yeongjin.jang@gatech.edu \
    /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;
as well as URLs for NNTP newsgroup(s).