]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86: cpa: clean up change_page_attr_set/clear()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 30 Jan 2008 12:34:08 +0000 (13:34 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:34:08 +0000 (13:34 +0100)
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/mm/pageattr.c

index 5cfc0d4ade567ce802d96173dc1bc3f7ce78b3c4..145f5edf488a01deb393d3bc0021ea80c937078d 100644 (file)
@@ -312,10 +312,10 @@ static int change_page_attr_set(unsigned long addr, int numpages,
        for (i = 0; i < numpages ; i++) {
 
                pte = lookup_address(addr, &level);
-               if (pte)
-                       current_prot = pte_pgprot(*pte);
-               else
-                       pgprot_val(current_prot) = 0;
+               if (!pte)
+                       return -EINVAL;
+
+               current_prot = pte_pgprot(*pte);
 
                pgprot_val(new_prot) =
                        pgprot_val(current_prot) | pgprot_val(prot);
@@ -356,11 +356,12 @@ static int change_page_attr_clear(unsigned long addr, int numpages,
        int i, ret;
 
        for (i = 0; i < numpages; i++) {
+
                pte = lookup_address(addr, &level);
-               if (pte)
-                       current_prot = pte_pgprot(*pte);
-               else
-                       pgprot_val(current_prot) = 0;
+               if (!pte)
+                       return -EINVAL;
+
+               current_prot = pte_pgprot(*pte);
 
                pgprot_val(new_prot) =
                                pgprot_val(current_prot) & ~pgprot_val(prot);