Skip to contentSkip to conversation

drm: An uninitialized return value is returned.

PATCH In review Il Han 3 participants 4 messages Jun 3, 2012

Subsystems (3)
lore
Share & tools
lore

Il Han

author
#0 lore raw

PATCH 1/1 drm: An uninitialized return value is returned.

An uninitialized return value is returned.
If the value is not necessary,
it would be better to return the constant 0.

---
 drivers/gpu/drm/nouveau/nv04_fence.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nv04_fence.c +1 -2
index abe89db..d4091eb 100644
@@ -121,7 +121,6 @@ nv04_fence_create(struct drm_device *dev)
 {
 	struct drm_nouveau_private *dev_priv = dev->dev_private;
 	struct nv04_fence_priv *priv;
-	int ret;
 
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -136,5 +135,5 @@ nv04_fence_create(struct drm_device *dev)
 	priv->base.sync = nv04_fence_sync;
 	priv->base.read = nv04_fence_read;
 	dev_priv->eng[NVOBJ_ENGINE_FENCE] = &priv->base.engine;
-	return ret;
+	return 0;
 }
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 32 lines · Il Han

An uninitialized return value is returned.
If the value is not necessary,
it would be better to return the constant 0.

---
 drivers/gpu/drm/nouveau/nv04_fence.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nv04_fence.c +1 -3
index abe89db..d4091eb 100644
@@ -121,7 +121,6 @@ nv04_fence_create(struct drm_device *dev)
 {
       struct drm_nouveau_private *dev_priv = dev->dev_private;
       struct nv04_fence_priv *priv;
-       int ret;
 
       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
       if (!priv)
@@ -136,5 +135,5 @@ nv04_fence_create(struct drm_device *dev)
       priv->base.sync = nv04_fence_sync;
       priv->base.read = nv04_fence_read;
       dev_priv->eng[NVOBJ_ENGINE_FENCE] = &priv->base.engine;
-       return ret;
+       return 0;
 }
--

1.7.4.1

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Hi All,

Why not modify "int ret;" to "int ret = 0;"? Below is the benefit:
1. return the constant 0 as wish.
2. The variable ret can be used if we want.

Best Regards,
Bing

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to Il Han
Quoted 31 lines · Il Han

An uninitialized return value is returned.
If the value is not necessary,
it would be better to return the constant 0.

---
 drivers/gpu/drm/nouveau/nv04_fence.c |    3 +--

 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nv04_fence.c +1 -3
index abe89db..d4091eb 100644
@@ -121,7 +121,6 @@ nv04_fence_create(struct drm_device *dev)
  {
        struct drm_nouveau_private *dev_priv = dev->dev_private;
        struct nv04_fence_priv *priv;
-       int ret;
 
        priv = kzalloc(sizeof(*priv), GFP_KERNEL);
        if (!priv)
@@ -136,5 +135,5 @@ nv04_fence_create(struct drm_device *dev)
        priv->base.sync = nv04_fence_sync;
        priv->base.read = nv04_fence_read;
        dev_priv->eng[NVOBJ_ENGINE_FENCE] = &priv->base.engine;
-       return ret;
+       return 0;
  }
--

1.7.4.1

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Hi All,

Why not modify "int ret;" to "int ret = 0;"? Below is the benefit:
1. return the constant 0 as wish.
2. The variable ret can be used if we want.

Signature · 2 lines
Best Regards,
Bing
#3 lore raw
Quoted 5 lines · bing deng

Hi All,

   Why not modify "int ret;" to "int ret = 0;"? Below is the benefit:
   1. return the constant 0 as wish.
   2. The variable ret can be used if we want.

Why? ret is in vain and wastes memory...

Signature · 2 lines
Thanks,
//richard