vme: ca91cx42: Adjust 14 checks for null pointers
MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script “checkpatch.pl” pointed information out like the following. Comparison to NULL could be written … Thus fix the affected source code places. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Martyn Welch <martyn@welchs.me.uk>
This commit is contained in:
Родитель
3d9b1e5334
Коммит
8d97931740
|
@ -511,7 +511,7 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
|
||||||
ca91cx42_bridge = image->parent;
|
ca91cx42_bridge = image->parent;
|
||||||
|
|
||||||
/* Find pci_dev container of dev */
|
/* Find pci_dev container of dev */
|
||||||
if (ca91cx42_bridge->parent == NULL) {
|
if (!ca91cx42_bridge->parent) {
|
||||||
dev_err(ca91cx42_bridge->parent, "Dev entry NULL\n");
|
dev_err(ca91cx42_bridge->parent, "Dev entry NULL\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -532,9 +532,9 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
|
||||||
memset(&image->bus_resource, 0, sizeof(image->bus_resource));
|
memset(&image->bus_resource, 0, sizeof(image->bus_resource));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image->bus_resource.name == NULL) {
|
if (!image->bus_resource.name) {
|
||||||
image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_ATOMIC);
|
image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_ATOMIC);
|
||||||
if (image->bus_resource.name == NULL) {
|
if (!image->bus_resource.name) {
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
goto err_name;
|
goto err_name;
|
||||||
}
|
}
|
||||||
|
@ -560,7 +560,7 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
|
||||||
|
|
||||||
image->kern_base = ioremap_nocache(
|
image->kern_base = ioremap_nocache(
|
||||||
image->bus_resource.start, size);
|
image->bus_resource.start, size);
|
||||||
if (image->kern_base == NULL) {
|
if (!image->kern_base) {
|
||||||
dev_err(ca91cx42_bridge->parent, "Failed to remap resource\n");
|
dev_err(ca91cx42_bridge->parent, "Failed to remap resource\n");
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
goto err_remap;
|
goto err_remap;
|
||||||
|
@ -1035,7 +1035,7 @@ static int ca91cx42_dma_list_add(struct vme_dma_list *list,
|
||||||
|
|
||||||
/* XXX descriptor must be aligned on 64-bit boundaries */
|
/* XXX descriptor must be aligned on 64-bit boundaries */
|
||||||
entry = kmalloc(sizeof(*entry), GFP_KERNEL);
|
entry = kmalloc(sizeof(*entry), GFP_KERNEL);
|
||||||
if (entry == NULL) {
|
if (!entry) {
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
goto err_mem;
|
goto err_mem;
|
||||||
}
|
}
|
||||||
|
@ -1319,7 +1319,7 @@ static int ca91cx42_lm_set(struct vme_lm_resource *lm,
|
||||||
|
|
||||||
/* If we already have a callback attached, we can't move it! */
|
/* If we already have a callback attached, we can't move it! */
|
||||||
for (i = 0; i < lm->monitors; i++) {
|
for (i = 0; i < lm->monitors; i++) {
|
||||||
if (bridge->lm_callback[i] != NULL) {
|
if (bridge->lm_callback[i]) {
|
||||||
mutex_unlock(&lm->mtx);
|
mutex_unlock(&lm->mtx);
|
||||||
dev_err(dev, "Location monitor callback attached, "
|
dev_err(dev, "Location monitor callback attached, "
|
||||||
"can't reset\n");
|
"can't reset\n");
|
||||||
|
@ -1428,7 +1428,7 @@ static int ca91cx42_lm_attach(struct vme_lm_resource *lm, int monitor,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check that a callback isn't already attached */
|
/* Check that a callback isn't already attached */
|
||||||
if (bridge->lm_callback[monitor] != NULL) {
|
if (bridge->lm_callback[monitor]) {
|
||||||
mutex_unlock(&lm->mtx);
|
mutex_unlock(&lm->mtx);
|
||||||
dev_err(dev, "Existing callback attached\n");
|
dev_err(dev, "Existing callback attached\n");
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
@ -1563,7 +1563,7 @@ static int ca91cx42_crcsr_init(struct vme_bridge *ca91cx42_bridge,
|
||||||
/* Allocate mem for CR/CSR image */
|
/* Allocate mem for CR/CSR image */
|
||||||
bridge->crcsr_kernel = pci_zalloc_consistent(pdev, VME_CRCSR_BUF_SIZE,
|
bridge->crcsr_kernel = pci_zalloc_consistent(pdev, VME_CRCSR_BUF_SIZE,
|
||||||
&bridge->crcsr_bus);
|
&bridge->crcsr_bus);
|
||||||
if (bridge->crcsr_kernel == NULL) {
|
if (!bridge->crcsr_kernel) {
|
||||||
dev_err(&pdev->dev, "Failed to allocate memory for CR/CSR "
|
dev_err(&pdev->dev, "Failed to allocate memory for CR/CSR "
|
||||||
"image\n");
|
"image\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -1615,14 +1615,14 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
* dynamically allocate the bridge structure
|
* dynamically allocate the bridge structure
|
||||||
*/
|
*/
|
||||||
ca91cx42_bridge = kzalloc(sizeof(*ca91cx42_bridge), GFP_KERNEL);
|
ca91cx42_bridge = kzalloc(sizeof(*ca91cx42_bridge), GFP_KERNEL);
|
||||||
if (ca91cx42_bridge == NULL) {
|
if (!ca91cx42_bridge) {
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
goto err_struct;
|
goto err_struct;
|
||||||
}
|
}
|
||||||
vme_init_bridge(ca91cx42_bridge);
|
vme_init_bridge(ca91cx42_bridge);
|
||||||
|
|
||||||
ca91cx42_device = kzalloc(sizeof(*ca91cx42_device), GFP_KERNEL);
|
ca91cx42_device = kzalloc(sizeof(*ca91cx42_device), GFP_KERNEL);
|
||||||
if (ca91cx42_device == NULL) {
|
if (!ca91cx42_device) {
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
goto err_driver;
|
goto err_driver;
|
||||||
}
|
}
|
||||||
|
@ -1679,7 +1679,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
/* Add master windows to list */
|
/* Add master windows to list */
|
||||||
for (i = 0; i < CA91C142_MAX_MASTER; i++) {
|
for (i = 0; i < CA91C142_MAX_MASTER; i++) {
|
||||||
master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
|
master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
|
||||||
if (master_image == NULL) {
|
if (!master_image) {
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
goto err_master;
|
goto err_master;
|
||||||
}
|
}
|
||||||
|
@ -1702,7 +1702,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
/* Add slave windows to list */
|
/* Add slave windows to list */
|
||||||
for (i = 0; i < CA91C142_MAX_SLAVE; i++) {
|
for (i = 0; i < CA91C142_MAX_SLAVE; i++) {
|
||||||
slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
|
slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
|
||||||
if (slave_image == NULL) {
|
if (!slave_image) {
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
goto err_slave;
|
goto err_slave;
|
||||||
}
|
}
|
||||||
|
@ -1726,7 +1726,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
/* Add dma engines to list */
|
/* Add dma engines to list */
|
||||||
for (i = 0; i < CA91C142_MAX_DMA; i++) {
|
for (i = 0; i < CA91C142_MAX_DMA; i++) {
|
||||||
dma_ctrlr = kmalloc(sizeof(*dma_ctrlr), GFP_KERNEL);
|
dma_ctrlr = kmalloc(sizeof(*dma_ctrlr), GFP_KERNEL);
|
||||||
if (dma_ctrlr == NULL) {
|
if (!dma_ctrlr) {
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
goto err_dma;
|
goto err_dma;
|
||||||
}
|
}
|
||||||
|
@ -1744,7 +1744,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
|
|
||||||
/* Add location monitor to list */
|
/* Add location monitor to list */
|
||||||
lm = kmalloc(sizeof(*lm), GFP_KERNEL);
|
lm = kmalloc(sizeof(*lm), GFP_KERNEL);
|
||||||
if (lm == NULL) {
|
if (!lm) {
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
goto err_lm;
|
goto err_lm;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче