linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arend van Spriel" <arend@broadcom.com>
To: "Hauke Mehrtens" <hauke@hauke-m.de>
Cc: linville@tuxdriver.com, zajec5@gmail.com,
	b43-dev@lists.infradead.org, linux-wireless@vger.kernel.org
Subject: Re: [PATCH] bcma: fix null pointer in bcma_core_pci_irq_ctl
Date: Fri, 1 Jun 2012 10:12:30 +0200	[thread overview]
Message-ID: <4FC8796E.4060800@broadcom.com> (raw)
In-Reply-To: <1338496770-16381-1-git-send-email-hauke@hauke-m.de>

On 05/31/2012 10:39 PM, Hauke Mehrtens wrote:
> pc could be null if hosttype != BCMA_HOSTTYPE_PCI.
> If we are on a device without a pci core this function is called with
> pc = null by b43 and brcmsmac. If the host type is PCI we have a pci
> core as well and pc can not be null.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/bcma/driver_pci.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c
> index 9a96f14..884b7af 100644
> --- a/drivers/bcma/driver_pci.c
> +++ b/drivers/bcma/driver_pci.c
> @@ -232,7 +232,7 @@ void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc)
>  int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core,
>  			  bool enable)
>  {
> -	struct pci_dev *pdev = pc->core->bus->host_pci;
> +	struct pci_dev *pdev;
>  	u32 coremask, tmp;
>  	int err = 0;
>  
> @@ -243,6 +243,8 @@ int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core,
Could you change the if statement as well:
  - if (core->bus->hosttype != BCMA_HOSTTYPE_PCI) {
  + if (!pc || core->bus->hosttype != BCMA_HOSTTYPE_PCI)
>  		goto out;
  -  	}
>  
> +	pdev = pc->core->bus->host_pci;
> +
>  	err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
>  	if (err)
>  		goto out;

Gr. AvS


  reply	other threads:[~2012-06-01  8:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-31 20:39 [PATCH] bcma: fix null pointer in bcma_core_pci_irq_ctl Hauke Mehrtens
2012-06-01  8:12 ` Arend van Spriel [this message]
2012-06-01 20:33   ` Hauke Mehrtens
2012-06-01 22:56     ` Joe Perches

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=4FC8796E.4060800@broadcom.com \
    --to=arend@broadcom.com \
    --cc=b43-dev@lists.infradead.org \
    --cc=hauke@hauke-m.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=zajec5@gmail.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;
as well as URLs for NNTP newsgroup(s).