[patch 1/2] drivers/gpu/vga/vgaarb.c: add missing kfree

2011-11-15 Thread a...@linux-foundation.org
From: Julia Lawall 
Subject: drivers/gpu/vga/vgaarb.c: add missing kfree

kbuf is a buffer that is local to this function, so all of the error paths
leaving the function should release it.

Signed-off-by: Julia Lawall 
Cc: Dave Airlie 
Cc: Jesper Juhl 
Signed-off-by: Andrew Morton 
---

 drivers/gpu/vga/vgaarb.c |   18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff -puN drivers/gpu/vga/vgaarb.c~drivers-gpu-vga-vgaarbc-add-missing-kfree 
drivers/gpu/vga/vgaarb.c
--- a/drivers/gpu/vga/vgaarb.c~drivers-gpu-vga-vgaarbc-add-missing-kfree
+++ a/drivers/gpu/vga/vgaarb.c
@@ -993,14 +993,20 @@ static ssize_t vga_arb_write(struct file
uc = &priv->cards[i];
}

-   if (!uc)
-   return -EINVAL;
+   if (!uc) {
+   ret_val = -EINVAL;
+   goto done;
+   }

-   if (io_state & VGA_RSRC_LEGACY_IO && uc->io_cnt == 0)
-   return -EINVAL;
+   if (io_state & VGA_RSRC_LEGACY_IO && uc->io_cnt == 0) {
+   ret_val = -EINVAL;
+   goto done;
+   }

-   if (io_state & VGA_RSRC_LEGACY_MEM && uc->mem_cnt == 0)
-   return -EINVAL;
+   if (io_state & VGA_RSRC_LEGACY_MEM && uc->mem_cnt == 0) {
+   ret_val = -EINVAL;
+   goto done;
+   }

vga_put(pdev, io_state);

_


[patch 2/2] drm: avoid switching to text console if there is no panic timeout

2011-11-15 Thread a...@linux-foundation.org
From: Hugh Dickins 
Subject: drm: avoid switching to text console if there is no panic timeout

Add a check for panic_timeout in the drm_fb_helper_panic() notifier: if
we're going to reboot immediately, the user will not be able to see the
messages anyway, and messing with the video mode may display artifacts,
and certainly get into several layers of complexity (including mutexes and
memory allocations) which we shall be much safer to avoid.

[msb at chromium.org: edited commit message and modified to short-circuit 
panic_timeout < 0 instead of testing panic_timeout >= 0]
Signed-off-by: Hugh Dickins 
Signed-off-by: Mandeep Singh Baines 
Cc: Dave Airlie 
Acked-by: David Rientjes 
Acked-by: St?phane Marchesin 
Cc: Dave Young 
Signed-off-by: Andrew Morton 
---

 drivers/gpu/drm/drm_fb_helper.c |7 +++
 1 file changed, 7 insertions(+)

diff -puN 
drivers/gpu/drm/drm_fb_helper.c~drm-avoid-switching-to-text-console-if-there-is-no-panic-timeout
 drivers/gpu/drm/drm_fb_helper.c
--- 
a/drivers/gpu/drm/drm_fb_helper.c~drm-avoid-switching-to-text-console-if-there-is-no-panic-timeout
+++ a/drivers/gpu/drm/drm_fb_helper.c
@@ -255,6 +255,13 @@ bool drm_fb_helper_force_kernel_mode(voi
 int drm_fb_helper_panic(struct notifier_block *n, unsigned long ununsed,
void *panic_str)
 {
+   /*
+* It's a waste of time and effort to switch back to text console
+* if the kernel should reboot before panic messages can be seen.
+*/
+   if (panic_timeout < 0)
+   return 0;
+
printk(KERN_ERR "panic occurred, switching back to text console\n");
return drm_fb_helper_force_kernel_mode();
 }
_


[patch 2/2] include/linux/vgaarb.h: add missing part of include guard

2010-07-20 Thread a...@linux-foundation.org
From: Doug Goldstein 

vgaarb.h was missing the #define of the #ifndef at the top for the guard
to prevent multiple #include's from causing re-define errors

Signed-off-by: Doug Goldstein 
Cc: Dave Airlie 
Cc: Jesse Barnes 
Signed-off-by: Andrew Morton 
---

 include/linux/vgaarb.h |1 +
 1 file changed, 1 insertion(+)

diff -puN 
include/linux/vgaarb.h~include-linux-vgaarbh-add-missing-part-of-include-guard 
include/linux/vgaarb.h
--- 
a/include/linux/vgaarb.h~include-linux-vgaarbh-add-missing-part-of-include-guard
+++ a/include/linux/vgaarb.h
@@ -29,6 +29,7 @@
  */

 #ifndef LINUX_VGA_H
+#define LINUX_VGA_H

 #include 

_


[patch 1/2] drivers/gpu/drm/i915: remove duplicate structure field initialization

2010-07-20 Thread a...@linux-foundation.org
From: Julia Lawall 

In each case, is_mobile is defined twice to 1.  Drop one initialization.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// 
@r@
identifier I, s, fld;
position p0,p;
expression E;
@@

struct I s =@p0 { ... .fld at p = E, ...};

@s@
identifier I, s, r.fld;
position r.p0,p;
expression E;
@@

struct I s =@p0 { ... .fld at p = E, ...};

@script:python@
p0 << r.p0;
fld << r.fld;
ps << s.p;
pr << r.p;
@@

if int(ps[0].line)

Signed-off-by: Julia Lawall 
Signed-off-by: Andrew Morton 
---

 drivers/gpu/drm/i915/i915_drv.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -puN 
drivers/gpu/drm/i915/i915_drv.c~drivers-gpu-drm-i915-remove-duplicate-structure-field-initialization
 drivers/gpu/drm/i915/i915_drv.c
--- 
a/drivers/gpu/drm/i915/i915_drv.c~drivers-gpu-drm-i915-remove-duplicate-structure-field-initialization
+++ a/drivers/gpu/drm/i915/i915_drv.c
@@ -97,7 +97,7 @@ static const struct intel_device_info in
 };

 static const struct intel_device_info intel_i965gm_info = {
-   .is_i965g = 1, .is_mobile = 1, .is_i965gm = 1, .is_i9xx = 1,
+   .is_i965g = 1, .is_i965gm = 1, .is_i9xx = 1,
.is_mobile = 1, .has_fbc = 1, .has_rc6 = 1,
.has_hotplug = 1,
 };
@@ -114,7 +114,7 @@ static const struct intel_device_info in
 };

 static const struct intel_device_info intel_gm45_info = {
-   .is_i965g = 1, .is_mobile = 1, .is_g4x = 1, .is_i9xx = 1,
+   .is_i965g = 1, .is_g4x = 1, .is_i9xx = 1,
.is_mobile = 1, .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1,
.has_pipe_cxsr = 1,
.has_hotplug = 1,
_


[patch 1/1] drivers/gpu/drm/radeon/atom.c: fix warning

2010-10-01 Thread a...@linux-foundation.org
From: Andrew Morton 

drivers/gpu/drm/radeon/atom.c: In function 'atom_op_delay':
drivers/gpu/drm/radeon/atom.c:653: warning: comparison is always false due to 
limited range of data type

Cc: David Airlie 
Cc: Alex Deucher 
Cc: Matt Turner 
Signed-off-by: Andrew Morton 
---

 drivers/gpu/drm/radeon/atom.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/gpu/drm/radeon/atom.c~drivers-gpu-drm-radeon-atomc-fix-warning 
drivers/gpu/drm/radeon/atom.c
--- a/drivers/gpu/drm/radeon/atom.c~drivers-gpu-drm-radeon-atomc-fix-warning
+++ a/drivers/gpu/drm/radeon/atom.c
@@ -647,7 +647,7 @@ static void atom_op_compare(atom_exec_co

 static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg)
 {
-   uint8_t count = U8((*ptr)++);
+   unsigned count = U8((*ptr)++);
SDEBUG("   count: %d\n", count);
if (arg == ATOM_UNIT_MICROSEC)
udelay(count);
_


[patch 1/1] drivers/gpu/drm/radeon/atom.c: fix warning

2010-10-20 Thread a...@linux-foundation.org
From: Andrew Morton 

drivers/gpu/drm/radeon/atom.c: In function 'atom_op_delay':
drivers/gpu/drm/radeon/atom.c:653: warning: comparison is always false due to 
limited range of data type

Cc: David Airlie 
Cc: Alex Deucher 
Cc: Matt Turner 
Signed-off-by: Andrew Morton 
---

 drivers/gpu/drm/radeon/atom.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/gpu/drm/radeon/atom.c~drivers-gpu-drm-radeon-atomc-fix-warning 
drivers/gpu/drm/radeon/atom.c
--- a/drivers/gpu/drm/radeon/atom.c~drivers-gpu-drm-radeon-atomc-fix-warning
+++ a/drivers/gpu/drm/radeon/atom.c
@@ -647,7 +647,7 @@ static void atom_op_compare(atom_exec_co

 static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg)
 {
-   uint8_t count = U8((*ptr)++);
+   unsigned count = U8((*ptr)++);
SDEBUG("   count: %d\n", count);
if (arg == ATOM_UNIT_MICROSEC)
udelay(count);
_