Hi,
Please find attached a fix to davincifb.c.
I am new to git and am not aware of the procedure to be followed while
submitting patches. I have generated the by doing
$ git diff > davincifb.patch

If i need to follow a particular procedure while submitting patches
please guide me in doing so. Following is the patch description
---
ISSUE: If a window other than VID0 is disabled at boot time, then the
kernel wont boot.
Through my investigation is found that illegal accesses are made to
the disabled windows in davincifb_isr(), for example if VID1 is
disabled then an access is still made via xchg(&addr,
dm->vid1->sdram_address) in davinfb_isr() due to which the kernel
won't boot as dm->vid1 is NULL.

The patch adds a check to verify that the dm->{osd0,osd1,vid1}
variables are not NULL before the access is made. the check is not
added for VID0 window because if VID0 is disabled then all the windows
are disabled and the ISR itself is not registered.

I have tested this patch on dm6446 at PAL COMPOSITE resolution.

diff --git a/drivers/video/davincifb.c b/drivers/video/davincifb.c
index 1344be7..199c335 100644
--- a/drivers/video/davincifb.c
+++ b/drivers/video/davincifb.c
@@ -295,20 +295,26 @@ static irqreturn_t davincifb_isr(int irq, void *arg)
        unsigned long addr=0;

        if ((dispc_reg_in(VENC_VSTAT) & 0x00000010) == 0x10) {
-               xchg(&addr, dm->osd0->sdram_address);
-               if (addr) {
-                       set_sdram_params(dm->osd0->info.fix.id,
-                                        dm->osd0->sdram_address,
-                                        dm->osd0->info.fix.line_length);
-                       dm->osd0->sdram_address = 0;
+               if (dm->osd0)
+               {
+                       xchg(&addr, dm->osd0->sdram_address);
+                       if (addr) {
+                               set_sdram_params(dm->osd0->info.fix.id,
+                                               dm->osd0->sdram_address,
+                                               dm->osd0->info.fix.line_length);
+                               dm->osd0->sdram_address = 0;
+                       }
                }
-               addr = 0;
-               xchg(&addr, dm->osd1->sdram_address);
-               if (addr) {
-                       set_sdram_params(dm->osd1->info.fix.id,
-                                        dm->osd1->sdram_address,
-                                        dm->osd1->info.fix.line_length);
-                       dm->osd1->sdram_address = 0;
+               if (dm->osd1)
+               {
+                       addr = 0;
+                       xchg(&addr, dm->osd1->sdram_address);
+                       if (addr) {
+                               set_sdram_params(dm->osd1->info.fix.id,
+                                               dm->osd1->sdram_address,
+                                               dm->osd1->info.fix.line_length);
+                               dm->osd1->sdram_address = 0;
+                       }
                }
                addr = 0;
                xchg(&addr, dm->vid0->sdram_address);
@@ -318,13 +324,16 @@ static irqreturn_t davincifb_isr(int irq, void *arg)
                                         dm->vid0->info.fix.line_length);
                        dm->vid0->sdram_address = 0;
                }
-               addr = 0;
-               xchg(&addr, dm->vid1->sdram_address);
-               if (addr) {
-                       set_sdram_params(dm->vid1->info.fix.id,
-                                        dm->vid1->sdram_address,
-                                        dm->vid1->info.fix.line_length);
-                       dm->vid1->sdram_address = 0;
+               if (dm->vid1)
+               {
+                       addr = 0;
+                       xchg(&addr, dm->vid1->sdram_address);
+                       if (addr) {
+                               set_sdram_params(dm->vid1->info.fix.id,
+                                               dm->vid1->sdram_address,
+                                               dm->vid1->info.fix.line_length);
+                               dm->vid1->sdram_address = 0;
+                       }
                }
                return IRQ_HANDLED;
        } else {

Regards
~Sameer
diff --git a/drivers/video/davincifb.c b/drivers/video/davincifb.c
index 1344be7..199c335 100644
--- a/drivers/video/davincifb.c
+++ b/drivers/video/davincifb.c
@@ -295,20 +295,26 @@ static irqreturn_t davincifb_isr(int irq, void *arg)
 	unsigned long addr=0;
 
 	if ((dispc_reg_in(VENC_VSTAT) & 0x00000010) == 0x10) {
-		xchg(&addr, dm->osd0->sdram_address);
-		if (addr) {
-			set_sdram_params(dm->osd0->info.fix.id,
-					 dm->osd0->sdram_address,
-					 dm->osd0->info.fix.line_length);
-			dm->osd0->sdram_address = 0;
+		if (dm->osd0)
+		{
+			xchg(&addr, dm->osd0->sdram_address);
+			if (addr) {
+				set_sdram_params(dm->osd0->info.fix.id,
+						dm->osd0->sdram_address,
+						dm->osd0->info.fix.line_length);
+				dm->osd0->sdram_address = 0;
+			}
 		}
-		addr = 0;
-		xchg(&addr, dm->osd1->sdram_address);
-		if (addr) {
-			set_sdram_params(dm->osd1->info.fix.id,
-					 dm->osd1->sdram_address,
-					 dm->osd1->info.fix.line_length);
-			dm->osd1->sdram_address = 0;
+		if (dm->osd1)
+		{
+			addr = 0;
+			xchg(&addr, dm->osd1->sdram_address);
+			if (addr) {
+				set_sdram_params(dm->osd1->info.fix.id,
+						dm->osd1->sdram_address,
+						dm->osd1->info.fix.line_length);
+				dm->osd1->sdram_address = 0;
+			}
 		}
 		addr = 0;
 		xchg(&addr, dm->vid0->sdram_address);
@@ -318,13 +324,16 @@ static irqreturn_t davincifb_isr(int irq, void *arg)
 					 dm->vid0->info.fix.line_length);
 			dm->vid0->sdram_address = 0;
 		}
-		addr = 0;
-		xchg(&addr, dm->vid1->sdram_address);
-		if (addr) {
-			set_sdram_params(dm->vid1->info.fix.id,
-					 dm->vid1->sdram_address,
-					 dm->vid1->info.fix.line_length);
-			dm->vid1->sdram_address = 0;
+		if (dm->vid1)
+		{
+			addr = 0;
+			xchg(&addr, dm->vid1->sdram_address);
+			if (addr) {
+				set_sdram_params(dm->vid1->info.fix.id,
+						dm->vid1->sdram_address,
+						dm->vid1->info.fix.line_length);
+				dm->vid1->sdram_address = 0;
+			}
 		}
 		return IRQ_HANDLED;
 	} else {
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to