* [PATCH] drm: An uninitialized return value is returned.
@ 2012-06-03 10:41 Il Han
2012-06-03 12:26 ` bing deng
0 siblings, 1 reply; 3+ messages in thread
From: Il Han @ 2012-06-03 10:41 UTC (permalink / raw)
To: David Airlie; +Cc: dri-devel, linux-kernel, Il Han
An uninitialized return value is returned.
If the value is not necessary,
it would be better to return the constant 0.
Signed-off-by: Il Han <corone.il.han@gmail.com>
---
drivers/gpu/drm/nouveau/nv04_fence.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nv04_fence.c b/drivers/gpu/drm/nouveau/nv04_fence.c
index abe89db..d4091eb 100644
--- a/drivers/gpu/drm/nouveau/nv04_fence.c
+++ b/drivers/gpu/drm/nouveau/nv04_fence.c
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drm: An uninitialized return value is returned.
2012-06-03 10:41 [PATCH] drm: An uninitialized return value is returned Il Han
@ 2012-06-03 12:26 ` bing deng
2012-06-03 13:26 ` richard -rw- weinberger
0 siblings, 1 reply; 3+ messages in thread
From: bing deng @ 2012-06-03 12:26 UTC (permalink / raw)
To: Il Han; +Cc: David Airlie, dri-devel, linux-kernel
On Sun, Jun 3, 2012 at 6:41 PM, Il Han <corone.il.han@gmail.com> wrote:
> An uninitialized return value is returned.
> If the value is not necessary,
> it would be better to return the constant 0.
>
> Signed-off-by: Il Han <corone.il.han@gmail.com>
> ---
> drivers/gpu/drm/nouveau/nv04_fence.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nv04_fence.c b/drivers/gpu/drm/nouveau/nv04_fence.c
> index abe89db..d4091eb 100644
> --- a/drivers/gpu/drm/nouveau/nv04_fence.c
> +++ b/drivers/gpu/drm/nouveau/nv04_fence.c
> @@ -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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-03 13:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-03 10:41 [PATCH] drm: An uninitialized return value is returned Il Han
2012-06-03 12:26 ` bing deng
2012-06-03 13:26 ` richard -rw- weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox