]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/sdrc.c
SDRC: prevent null pointer dereference if sdrc_init_params is null
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / sdrc.c
index 7c2e36cf516a0f0e26bfe9a9ae49436803f8a624..993fd253cb9cb4bca12e7348210e1715ed6b9d67 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <asm/arch/common.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/sram.h>
+#include <mach/common.h>
+#include <mach/clock.h>
+#include <mach/sram.h>
 
 #include "prm.h"
 
-#include <asm/arch/sdrc.h>
+#include <mach/sdrc.h>
 #include "sdrc.h"
 
 static struct omap_sdrc_params *sdrc_init_params;
@@ -56,9 +56,12 @@ struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r)
 {
        struct omap_sdrc_params *sp;
 
+       if (!sdrc_init_params)
+               return NULL;
+
        sp = sdrc_init_params;
 
-       while (sp->rate != r)
+       while (sp->rate && sp->rate != r)
                sp++;
 
        if (!sp->rate)