Skip to content

Commit a75dc63

Browse files
elfringmwelchuk
authored andcommitted
vme: tsi148: 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 <[email protected]> Signed-off-by: Martyn Welch <[email protected]>
1 parent 6d011dd commit a75dc63

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

drivers/vme/bridges/vme_tsi148.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -748,9 +748,9 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
748748
if (size == 0)
749749
return 0;
750750

751-
if (image->bus_resource.name == NULL) {
751+
if (!image->bus_resource.name) {
752752
image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_ATOMIC);
753-
if (image->bus_resource.name == NULL) {
753+
if (!image->bus_resource.name) {
754754
retval = -ENOMEM;
755755
goto err_name;
756756
}
@@ -776,7 +776,7 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
776776

777777
image->kern_base = ioremap_nocache(
778778
image->bus_resource.start, size);
779-
if (image->kern_base == NULL) {
779+
if (!image->kern_base) {
780780
dev_err(tsi148_bridge->parent, "Failed to remap resource\n");
781781
retval = -ENOMEM;
782782
goto err_remap;
@@ -1640,7 +1640,7 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
16401640

16411641
/* Descriptor must be aligned on 64-bit boundaries */
16421642
entry = kmalloc(sizeof(*entry), GFP_KERNEL);
1643-
if (entry == NULL) {
1643+
if (!entry) {
16441644
retval = -ENOMEM;
16451645
goto err_mem;
16461646
}
@@ -1943,7 +1943,7 @@ static int tsi148_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base,
19431943

19441944
/* If we already have a callback attached, we can't move it! */
19451945
for (i = 0; i < lm->monitors; i++) {
1946-
if (bridge->lm_callback[i] != NULL) {
1946+
if (bridge->lm_callback[i]) {
19471947
mutex_unlock(&lm->mtx);
19481948
dev_err(tsi148_bridge->parent, "Location monitor "
19491949
"callback attached, can't reset\n");
@@ -2068,7 +2068,7 @@ static int tsi148_lm_attach(struct vme_lm_resource *lm, int monitor,
20682068
}
20692069

20702070
/* Check that a callback isn't already attached */
2071-
if (bridge->lm_callback[monitor] != NULL) {
2071+
if (bridge->lm_callback[monitor]) {
20722072
mutex_unlock(&lm->mtx);
20732073
dev_err(tsi148_bridge->parent, "Existing callback attached\n");
20742074
return -EBUSY;
@@ -2205,7 +2205,7 @@ static int tsi148_crcsr_init(struct vme_bridge *tsi148_bridge,
22052205
/* Allocate mem for CR/CSR image */
22062206
bridge->crcsr_kernel = pci_zalloc_consistent(pdev, VME_CRCSR_BUF_SIZE,
22072207
&bridge->crcsr_bus);
2208-
if (bridge->crcsr_kernel == NULL) {
2208+
if (!bridge->crcsr_kernel) {
22092209
dev_err(tsi148_bridge->parent, "Failed to allocate memory for "
22102210
"CR/CSR image\n");
22112211
return -ENOMEM;
@@ -2292,14 +2292,14 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
22922292
* dynamically generate this so we get one per device
22932293
*/
22942294
tsi148_bridge = kzalloc(sizeof(*tsi148_bridge), GFP_KERNEL);
2295-
if (tsi148_bridge == NULL) {
2295+
if (!tsi148_bridge) {
22962296
retval = -ENOMEM;
22972297
goto err_struct;
22982298
}
22992299
vme_init_bridge(tsi148_bridge);
23002300

23012301
tsi148_device = kzalloc(sizeof(*tsi148_device), GFP_KERNEL);
2302-
if (tsi148_device == NULL) {
2302+
if (!tsi148_device) {
23032303
retval = -ENOMEM;
23042304
goto err_driver;
23052305
}
@@ -2366,7 +2366,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
23662366
tsi148_device->flush_image =
23672367
kmalloc(sizeof(*tsi148_device->flush_image),
23682368
GFP_KERNEL);
2369-
if (tsi148_device->flush_image == NULL) {
2369+
if (!tsi148_device->flush_image) {
23702370
retval = -ENOMEM;
23712371
goto err_master;
23722372
}
@@ -2382,7 +2382,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
23822382
/* Add master windows to list */
23832383
for (i = 0; i < master_num; i++) {
23842384
master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
2385-
if (master_image == NULL) {
2385+
if (!master_image) {
23862386
retval = -ENOMEM;
23872387
goto err_master;
23882388
}
@@ -2408,7 +2408,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
24082408
/* Add slave windows to list */
24092409
for (i = 0; i < TSI148_MAX_SLAVE; i++) {
24102410
slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
2411-
if (slave_image == NULL) {
2411+
if (!slave_image) {
24122412
retval = -ENOMEM;
24132413
goto err_slave;
24142414
}
@@ -2429,7 +2429,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
24292429
/* Add dma engines to list */
24302430
for (i = 0; i < TSI148_MAX_DMA; i++) {
24312431
dma_ctrlr = kmalloc(sizeof(*dma_ctrlr), GFP_KERNEL);
2432-
if (dma_ctrlr == NULL) {
2432+
if (!dma_ctrlr) {
24332433
retval = -ENOMEM;
24342434
goto err_dma;
24352435
}
@@ -2449,7 +2449,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
24492449

24502450
/* Add location monitor to list */
24512451
lm = kmalloc(sizeof(*lm), GFP_KERNEL);
2452-
if (lm == NULL) {
2452+
if (!lm) {
24532453
retval = -ENOMEM;
24542454
goto err_lm;
24552455
}

0 commit comments

Comments
 (0)