mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] gpu, drm, sis: Don't return uninitialized variable from sis_driver_load()
@ 2012-01-14 20:20 Jesper Juhl
  2012-01-15  0:09 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2012-01-14 20:20 UTC (permalink / raw)
  To: linux-kernel
  Cc: dri-devel, Arjan van de Ven, Paul Gortmaker, Dave Airlie,
	Daniel Vetter, David Airlie

In sis_driver_load(), the only use of 'ret' is as the return value
from the function, unfortunately it is never initialized, so the
function just returns garbage when it succeeds.
To fix that, remove the variable and just return 0 directly on success.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/gpu/drm/sis/sis_drv.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

 I don't have hardware to test, so it has only been compile tested.

diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c
index 06da063..573220c 100644
--- a/drivers/gpu/drm/sis/sis_drv.c
+++ b/drivers/gpu/drm/sis/sis_drv.c
@@ -40,7 +40,6 @@ static struct pci_device_id pciidlist[] = {
 static int sis_driver_load(struct drm_device *dev, unsigned long chipset)
 {
 	drm_sis_private_t *dev_priv;
-	int ret;
 
 	dev_priv = kzalloc(sizeof(drm_sis_private_t), GFP_KERNEL);
 	if (dev_priv == NULL)
@@ -50,7 +49,7 @@ static int sis_driver_load(struct drm_device *dev, unsigned long chipset)
 	dev_priv->chipset = chipset;
 	idr_init(&dev->object_name_idr);
 
-	return ret;
+	return 0;
 }
 
 static int sis_driver_unload(struct drm_device *dev)
-- 
1.7.8.3


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] gpu, drm, sis: Don't return uninitialized variable from sis_driver_load()
  2012-01-14 20:20 [PATCH] gpu, drm, sis: Don't return uninitialized variable from sis_driver_load() Jesper Juhl
@ 2012-01-15  0:09 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2012-01-15  0:09 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: linux-kernel, dri-devel, Arjan van de Ven, Paul Gortmaker,
	Dave Airlie, Daniel Vetter, David Airlie

On Sat, Jan 14, 2012 at 09:20:37PM +0100, Jesper Juhl wrote:
> In sis_driver_load(), the only use of 'ret' is as the return value
> from the function, unfortunately it is never initialized, so the
> function just returns garbage when it succeeds.
> To fix that, remove the variable and just return 0 directly on success.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Woot, not one of mine!

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-15  0:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-14 20:20 [PATCH] gpu, drm, sis: Don't return uninitialized variable from sis_driver_load() Jesper Juhl
2012-01-15  0:09 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®