Skip to content

Commit cf183c1

Browse files
Thomas-fouriermaddy-kerneldev
authored andcommitted
powerpc: floppy: Add missing checks after DMA map
The DMA map functions can fail and should be tested for errors. Signed-off-by: Thomas Fourier <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent f516479 commit cf183c1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/powerpc/include/asm/floppy.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,12 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
144144
bus_addr = 0;
145145
}
146146

147-
if (!bus_addr) /* need to map it */
147+
if (!bus_addr) { /* need to map it */
148148
bus_addr = dma_map_single(&isa_bridge_pcidev->dev, addr, size,
149149
dir);
150+
if (dma_mapping_error(&isa_bridge_pcidev->dev, bus_addr))
151+
return -ENOMEM;
152+
}
150153

151154
/* remember this one as prev */
152155
prev_addr = addr;

0 commit comments

Comments
 (0)