Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5a1c3e1aa977457ded6fd0739e032c9684bf23bd
Commit:     5a1c3e1aa977457ded6fd0739e032c9684bf23bd
Parent:     4c1fc445c29c6208c44e10c0253beea890bf5435
Author:     Julia Lawall <[EMAIL PROTECTED]>
AuthorDate: Mon Feb 4 22:27:44 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Feb 5 09:44:09 2008 -0800

    drivers/pcmcia: Add missing iounmap
    
    of_iomap calls ioremap, and so should be matched with an iounmap.  At the
    two error returns, the result of calling of_iomap is only stored in a local
    variable, so these error paths need to call iounmap.  Furthermore, this
    function ultimately stores the result of of_iomap in an array that is local
    to the file.  These values should be iounmapped at some point.  I have
    added a corresponding call to iounmap at the end of the function
    m8xx_remove.
    
    The problem was found using the following semantic match.
    (http://www.emn.fr/x-info/coccinelle/)
    
    // <smpl>
    @@
    type T,T1,T2;
    identifier E;
    statement S;
    expression x1,x2,x3;
    int ret;
    @@
    
      T E;
      ...
    * E = of_iomap(...);
      if (E == NULL) S
      ... when != iounmap(...,(T1)E,...)
          when != if (E != NULL) { ... iounmap(...,(T1)E,...); ...}
          when != x1 = (T1)E
          when != E = x3;
          when any
      if (...) {
        ... when != iounmap(...,(T2)E,...)
            when != if (E != NULL) { ... iounmap(...,(T2)E,...); ...}
            when != x2 = (T2)E
    (
    *   return;
    |
    *   return ret;
    )
      }
    // </smpl>
    
    Signed-off-by: Julia Lawall <[EMAIL PROTECTED]>
    Vitaly Bordug <[EMAIL PROTECTED]>
    Cc: Arnd Bergmann <[EMAIL PROTECTED]>
    Cc: Olof Johansson <[EMAIL PROTECTED]>
    Cc: Dominik Brodowski <[EMAIL PROTECTED]>
    Cc: Paul Mackerras <[EMAIL PROTECTED]>
    Cc: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
    Cc: Kumar Gala <[EMAIL PROTECTED]>
    Cc: Stephen Rothwell <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/pcmcia/m8xx_pcmcia.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index 4ea426a..ac70d2c 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -1174,8 +1174,10 @@ static int __init m8xx_probe(struct of_device *ofdev,
 
        pcmcia_schlvl = irq_of_parse_and_map(np, 0);
        hwirq = irq_map[pcmcia_schlvl].hwirq;
-       if (pcmcia_schlvl < 0)
+       if (pcmcia_schlvl < 0) {
+               iounmap(pcmcia);
                return -EINVAL;
+       }
 
        m8xx_pgcrx[0] = &pcmcia->pcmc_pgcra;
        m8xx_pgcrx[1] = &pcmcia->pcmc_pgcrb;
@@ -1189,6 +1191,7 @@ static int __init m8xx_probe(struct of_device *ofdev,
                        driver_name, socket)) {
                pcmcia_error("Cannot allocate IRQ %u for SCHLVL!\n",
                             pcmcia_schlvl);
+               iounmap(pcmcia);
                return -1;
        }
 
@@ -1284,6 +1287,7 @@ static int m8xx_remove(struct of_device *ofdev)
        }
        for (i = 0; i < PCMCIA_SOCKETS_NO; i++)
                pcmcia_unregister_socket(&socket[i].socket);
+       iounmap(pcmcia);
 
        free_irq(pcmcia_schlvl, NULL);
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to