ioremap balanced with iounmap for drivers/scsi/sun3_scsi.c
Subsystems (2)
PATCH 16/36 ioremap balanced with iounmap for drivers/scsi/sun3_scsi.c
From: Amol Lad <[email protected]>
ioremap must be balanced by an iounmap and failing to do so can result in a memory leak.
Signed-off-by Amol Lad <[email protected]>
Cc James Bottomley <[email protected]>
Cc "David S. Miller" <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
drivers/scsi/sun3_scsi.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/sun3_scsi.c renamed from drivers/scsi/sun3_scsi.c~ioremap-balanced-with-iounmap-drivers-scsi-sun3_scsic +6 -1
@@ -240,11 +240,13 @@ int sun3scsi_detect(struct scsi_host_temif ((udc_regs =dvma_malloc (sizeof (struct sun3_udc_regs ))) ==NULL ) {printk ("SUN3 Scsi couldn't allocate DVMA memory!\n" ); +iounmap ((void *)ioaddr);return 0 ; }#ifdef OLDDMA if ((dmabuf =dvma_malloc_align (SUN3_DVMA_BUFSIZE ,0x10000 )) ==NULL ) {printk ("SUN3 Scsi couldn't allocate DVMA memory!\n" ); +iounmap ((void *)ioaddr);return 0 ; }#endif
@@ -254,8 +256,10 @@ int sun3scsi_detect(struct scsi_host_tem#endif instance =scsi_register (tpnt,sizeof (struct NCR5380_hostdata )); -if (instance ==NULL ) +if (instance ==NULL ) { +iounmap ((void *)ioaddr);return 0 ; + } default_instance = instance;
@@ -277,6 +281,7 @@ int sun3scsi_detect(struct scsi_host_tem#else printk ("scsi%d: IRQ%d not free, bailing out\n" , instance->host_no, instance->irq); +iounmap ((void *)ioaddr);return 0 ;#endif }
_