public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: Jayamohan.Kallickal@Emulex.Com
Cc: linux-scsi@vger.kernel.org, mchristi@redhat.com
Subject: Re: [PATCH]: be2iscsi: Fix MSIX interrupt names
Date: Fri, 20 May 2011 14:51:39 -0400	[thread overview]
Message-ID: <4DD6B83B.5000703@redhat.com> (raw)
In-Reply-To: <50725EF61B96174EB1803401F1A2E37335099FC989@EXMAIL.ad.emulex.com>



On 05/20/2011 02:33 PM, Jayamohan.Kallickal@Emulex.Com wrote:
> Thanks for the patch. Pl see my comments in line
>
>   

np.

> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index 24e20ba..8d71e47 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -874,16 +874,20 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
>  	struct hwi_controller *phwi_ctrlr;
>  	struct hwi_context_memory *phwi_context;
>  	int ret, msix_vec, i, j;
> -	char desc[32];
>  
>  	phwi_ctrlr = phba->phwi_ctrlr;
>  	phwi_context = phwi_ctrlr->phwi_ctxt;
>  
>  	if (phba->msix_enabled) {
>  		for (i = 0; i < phba->num_cpus; i++) {
> -			sprintf(desc, "beiscsi_msix_%04x", i);
> +			phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME,
> +						    GFP_KERNEL);
> +			if (!phba->msi_name[i])
> +				goto free_msix_irqs;
> We need to ensure i != 0 before jumping to free_msix_irqs
>   

Will fix in next version ... I think I may have to do a bit more work
here because I just realized that if we free_irq() on a non-allocated
irq we'll get an angry message from the kernel ;)  Unfortunately this
may complicate the code.... I'll rework this and see if I can come up
with something better.

> +			sprintf(phba->msi_name[i], "beiscsi_msix_%04x", i);
>  			msix_vec = phba->msix_entries[i].vector;
> -			ret = request_irq(msix_vec, be_isr_msix, 0, desc,
> +			ret = request_irq(msix_vec, be_isr_msix, 0,
> +					  phba->msi_name[i],
>  					  &phwi_context->be_eq[i]);
>  			if (ret) {
>  				shost_printk(KERN_ERR, phba->shost,
> @@ -915,8 +919,10 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
>  	}
>  	return 0;
>  free_msix_irqs:
> -	for (j = i - 1; j == 0; j++)
> +	for (j = i - 1; j == 0; j++) {
>  		free_irq(msix_vec, &phwi_context->be_eq[j]);
> +		kfree(phba->msi_name[i]);
> +	}
>   

... I was looking at this, and I'm confused by it.

Should this really be 'j++'?  Or should it be j-- ?

It seems to make sense that this code is j-- ...


>  	return ret;
>  }
>  
> @@ -4117,10 +4123,13 @@ static void beiscsi_remove(struct pci_dev *pcidev)
>  		for (i = 0; i <= phba->num_cpus; i++) {
>  			msix_vec = phba->msix_entries[i].vector;
>  			free_irq(msix_vec, &phwi_context->be_eq[i]);
> +			kfree(phba->msi_name[i]);
>  		}
>  	} else
> -		if (phba->pcidev->irq)
> +		if (phba->pcidev->irq) {
>  			free_irq(phba->pcidev->irq, phba);
> +			kfree(phba->msi_name[i]);
> Do we need the free for non-msix case as we are not allocation?
>   

Fixed in next version.

<snip>

P.

  reply	other threads:[~2011-05-20 18:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4DD6AEB7.2090900@redhat.com>
2011-05-20 18:12 ` [PATCH]: be2iscsi: Fix MSIX interrupt names Prarit Bhargava
2011-05-20 18:33   ` Jayamohan.Kallickal
2011-05-20 18:51     ` Prarit Bhargava [this message]
2011-05-20 20:17       ` Rolf Eike Beer
2011-05-24 14:48         ` Prarit Bhargava
2011-05-24 15:09           ` Rolf Eike Beer
2011-06-01 18:55       ` Jayamohan.Kallickal
2011-06-01 19:41         ` Rolf Eike Beer
2011-06-01 23:50           ` Jayamohan.Kallickal
2011-06-02  9:35             ` Rolf Eike Beer
2011-05-20 19:13     ` Prarit Bhargava
2011-05-20 22:07       ` Jayamohan.Kallickal
2011-05-20 23:45         ` Prarit Bhargava
2011-05-23 17:22           ` Jayamohan.Kallickal

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=4DD6B83B.5000703@redhat.com \
    --to=prarit@redhat.com \
    --cc=Jayamohan.Kallickal@Emulex.Com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mchristi@redhat.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