summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-helpers.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-05-03 01:17:57 -0700
committerReinette Chatre <reinette.chatre@intel.com>2010-05-13 10:43:06 -0700
commitc9696b2b6c36704dbd1eb51fd4465704a395a6ff (patch)
tree792346a411b68057bb4c5ce5c5d9a6d44e48e3be /drivers/net/wireless/iwlwifi/iwl-helpers.h
parent1d60a79ed516edcc62c5f74e4223d21e10a5cc14 (diff)
downloadblackbird-op-linux-c9696b2b6c36704dbd1eb51fd4465704a395a6ff.tar.gz
blackbird-op-linux-c9696b2b6c36704dbd1eb51fd4465704a395a6ff.zip
iwlwifi: don't crash on firmware file missing info
If a firmware file misses one of the required instruction or data pieces, the driver currently crashes. Let it gracefully refuse that firmware file instead. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-helpers.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-helpers.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index 3ff6b9d25a10..69846395763b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h
+++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h
@@ -92,6 +92,11 @@ static inline void iwl_free_fw_desc(struct pci_dev *pci_dev,
static inline int iwl_alloc_fw_desc(struct pci_dev *pci_dev,
struct fw_desc *desc)
{
+ if (!desc->len) {
+ desc->v_addr = NULL;
+ return -EINVAL;
+ }
+
desc->v_addr = dma_alloc_coherent(&pci_dev->dev, desc->len,
&desc->p_addr, GFP_KERNEL);
return (desc->v_addr != NULL) ? 0 : -ENOMEM;
OpenPOWER on IntegriCloud