Commit 94eefcc1 authored by Markus Elfring's avatar Markus Elfring Committed by Martyn Welch

vme: Delete 11 error messages for a failed memory allocation

Omit extra messages for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarMartyn Welch <martyn@welchs.me.uk>
parent 8a5776a5
...@@ -337,10 +337,9 @@ struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address, ...@@ -337,10 +337,9 @@ struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address,
goto err_image; goto err_image;
resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL); resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL);
if (resource == NULL) { if (!resource)
printk(KERN_WARNING "Unable to allocate resource structure\n");
goto err_alloc; goto err_alloc;
}
resource->type = VME_SLAVE; resource->type = VME_SLAVE;
resource->entry = &allocated_image->list; resource->entry = &allocated_image->list;
...@@ -542,10 +541,9 @@ struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address, ...@@ -542,10 +541,9 @@ struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address,
} }
resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL); resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL);
if (resource == NULL) { if (!resource)
printk(KERN_ERR "Unable to allocate resource structure\n");
goto err_alloc; goto err_alloc;
}
resource->type = VME_MASTER; resource->type = VME_MASTER;
resource->entry = &allocated_image->list; resource->entry = &allocated_image->list;
...@@ -919,10 +917,9 @@ struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route) ...@@ -919,10 +917,9 @@ struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route)
goto err_ctrlr; goto err_ctrlr;
resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL); resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL);
if (resource == NULL) { if (!resource)
printk(KERN_WARNING "Unable to allocate resource structure\n");
goto err_alloc; goto err_alloc;
}
resource->type = VME_DMA; resource->type = VME_DMA;
resource->entry = &allocated_ctrlr->list; resource->entry = &allocated_ctrlr->list;
...@@ -962,10 +959,9 @@ struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource) ...@@ -962,10 +959,9 @@ struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource)
ctrlr = list_entry(resource->entry, struct vme_dma_resource, list); ctrlr = list_entry(resource->entry, struct vme_dma_resource, list);
dma_list = kmalloc(sizeof(struct vme_dma_list), GFP_KERNEL); dma_list = kmalloc(sizeof(struct vme_dma_list), GFP_KERNEL);
if (dma_list == NULL) { if (!dma_list)
printk(KERN_ERR "Unable to allocate memory for new DMA list\n");
return NULL; return NULL;
}
INIT_LIST_HEAD(&dma_list->entries); INIT_LIST_HEAD(&dma_list->entries);
dma_list->parent = ctrlr; dma_list->parent = ctrlr;
mutex_init(&dma_list->mtx); mutex_init(&dma_list->mtx);
...@@ -991,16 +987,12 @@ struct vme_dma_attr *vme_dma_pattern_attribute(u32 pattern, u32 type) ...@@ -991,16 +987,12 @@ struct vme_dma_attr *vme_dma_pattern_attribute(u32 pattern, u32 type)
struct vme_dma_pattern *pattern_attr; struct vme_dma_pattern *pattern_attr;
attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL); attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL);
if (attributes == NULL) { if (!attributes)
printk(KERN_ERR "Unable to allocate memory for attributes structure\n");
goto err_attr; goto err_attr;
}
pattern_attr = kmalloc(sizeof(struct vme_dma_pattern), GFP_KERNEL); pattern_attr = kmalloc(sizeof(struct vme_dma_pattern), GFP_KERNEL);
if (pattern_attr == NULL) { if (!pattern_attr)
printk(KERN_ERR "Unable to allocate memory for pattern attributes\n");
goto err_pat; goto err_pat;
}
attributes->type = VME_DMA_PATTERN; attributes->type = VME_DMA_PATTERN;
attributes->private = (void *)pattern_attr; attributes->private = (void *)pattern_attr;
...@@ -1035,18 +1027,12 @@ struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t address) ...@@ -1035,18 +1027,12 @@ struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t address)
/* XXX Run some sanity checks here */ /* XXX Run some sanity checks here */
attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL); attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL);
if (attributes == NULL) { if (!attributes)
printk(KERN_ERR "Unable to allocate memory for attributes structure\n");
goto err_attr; goto err_attr;
}
pci_attr = kmalloc(sizeof(struct vme_dma_pci), GFP_KERNEL); pci_attr = kmalloc(sizeof(struct vme_dma_pci), GFP_KERNEL);
if (pci_attr == NULL) { if (!pci_attr)
printk(KERN_ERR "Unable to allocate memory for PCI attributes\n");
goto err_pci; goto err_pci;
}
attributes->type = VME_DMA_PCI; attributes->type = VME_DMA_PCI;
attributes->private = (void *)pci_attr; attributes->private = (void *)pci_attr;
...@@ -1083,16 +1069,12 @@ struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long address, ...@@ -1083,16 +1069,12 @@ struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long address,
attributes = kmalloc( attributes = kmalloc(
sizeof(struct vme_dma_attr), GFP_KERNEL); sizeof(struct vme_dma_attr), GFP_KERNEL);
if (attributes == NULL) { if (!attributes)
printk(KERN_ERR "Unable to allocate memory for attributes structure\n");
goto err_attr; goto err_attr;
}
vme_attr = kmalloc(sizeof(struct vme_dma_vme), GFP_KERNEL); vme_attr = kmalloc(sizeof(struct vme_dma_vme), GFP_KERNEL);
if (vme_attr == NULL) { if (!vme_attr)
printk(KERN_ERR "Unable to allocate memory for VME attributes\n");
goto err_vme; goto err_vme;
}
attributes->type = VME_DMA_VME; attributes->type = VME_DMA_VME;
attributes->private = (void *)vme_attr; attributes->private = (void *)vme_attr;
...@@ -1539,10 +1521,9 @@ struct vme_resource *vme_lm_request(struct vme_dev *vdev) ...@@ -1539,10 +1521,9 @@ struct vme_resource *vme_lm_request(struct vme_dev *vdev)
goto err_lm; goto err_lm;
resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL); resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL);
if (resource == NULL) { if (!resource)
printk(KERN_ERR "Unable to allocate resource structure\n");
goto err_alloc; goto err_alloc;
}
resource->type = VME_LM; resource->type = VME_LM;
resource->entry = &allocated_lm->list; resource->entry = &allocated_lm->list;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment