Skip to content

Commit e28f701

Browse files
ArvindYadavCshdeller
authored andcommitted
parisc: ccio-dma: Handle return NULL error from ioremap_nocache
Fix error paths and return -ENOMEM instead of '1'. Signed-off-by: Arvind Yadav <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 09b871f commit e28f701

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/parisc/ccio-dma.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ static int __init ccio_probe(struct parisc_device *dev)
15391539
ioc = kzalloc(sizeof(struct ioc), GFP_KERNEL);
15401540
if (ioc == NULL) {
15411541
printk(KERN_ERR MODULE_NAME ": memory allocation failure\n");
1542-
return 1;
1542+
return -ENOMEM;
15431543
}
15441544

15451545
ioc->name = dev->id.hversion == U2_IOA_RUNWAY ? "U2" : "UTurn";
@@ -1554,6 +1554,10 @@ static int __init ccio_probe(struct parisc_device *dev)
15541554

15551555
ioc->hw_path = dev->hw_path;
15561556
ioc->ioc_regs = ioremap_nocache(dev->hpa.start, 4096);
1557+
if (!ioc->ioc_regs) {
1558+
kfree(ioc);
1559+
return -ENOMEM;
1560+
}
15571561
ccio_ioc_init(ioc);
15581562
ccio_init_resources(ioc);
15591563
hppa_dma_ops = &ccio_ops;

0 commit comments

Comments
 (0)