2019-10-19 09:56:38

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH] drm/radeon: remove assignment for return value

Remove unnecessary assignment for return value and have the
function return the required value directly.
Issue found by coccinelle:
@@
local idexpression ret;
expression e;
@@

-ret =
+return
e;
-return ret;

Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/radeon/cik.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 62eab82a64f9..daff9a2af3be 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -221,9 +221,7 @@ int ci_get_temp(struct radeon_device *rdev)
else
actual_temp = temp & 0x1ff;

- actual_temp = actual_temp * 1000;
-
- return actual_temp;
+ return actual_temp * 1000;
}

/* get temperature in millidegrees */
@@ -239,9 +237,7 @@ int kv_get_temp(struct radeon_device *rdev)
else
actual_temp = 0;

- actual_temp = actual_temp * 1000;
-
- return actual_temp;
+ return actual_temp * 1000;
}

/*
--
2.23.0


2019-10-24 02:35:53

by Harry Wentland

[permalink] [raw]
Subject: Re: [PATCH] drm/radeon: remove assignment for return value

On 2019-10-19 3:32 a.m., Wambui Karuga wrote:
> Remove unnecessary assignment for return value and have the
> function return the required value directly.
> Issue found by coccinelle:
> @@
> local idexpression ret;
> expression e;
> @@
>
> -ret =
> +return
> e;
> -return ret;
>
> Signed-off-by: Wambui Karuga <[email protected]>

Thanks for your patch.

Reviewed-by: Harry Wentland <[email protected]>

Harry


> ---
> drivers/gpu/drm/radeon/cik.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> index 62eab82a64f9..daff9a2af3be 100644
> --- a/drivers/gpu/drm/radeon/cik.c
> +++ b/drivers/gpu/drm/radeon/cik.c
> @@ -221,9 +221,7 @@ int ci_get_temp(struct radeon_device *rdev)
> else
> actual_temp = temp & 0x1ff;
>
> - actual_temp = actual_temp * 1000;
> -
> - return actual_temp;
> + return actual_temp * 1000;
> }
>
> /* get temperature in millidegrees */
> @@ -239,9 +237,7 @@ int kv_get_temp(struct radeon_device *rdev)
> else
> actual_temp = 0;
>
> - actual_temp = actual_temp * 1000;
> -
> - return actual_temp;
> + return actual_temp * 1000;
> }
>
> /*
>

2019-10-25 20:57:16

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH] drm/radeon: remove assignment for return value

Applied. Thanks!

Alex

On Wed, Oct 23, 2019 at 11:09 AM Harry Wentland <[email protected]> wrote:
>
> On 2019-10-19 3:32 a.m., Wambui Karuga wrote:
> > Remove unnecessary assignment for return value and have the
> > function return the required value directly.
> > Issue found by coccinelle:
> > @@
> > local idexpression ret;
> > expression e;
> > @@
> >
> > -ret =
> > +return
> > e;
> > -return ret;
> >
> > Signed-off-by: Wambui Karuga <[email protected]>
>
> Thanks for your patch.
>
> Reviewed-by: Harry Wentland <[email protected]>
>
> Harry
>
>
> > ---
> > drivers/gpu/drm/radeon/cik.c | 8 ++------
> > 1 file changed, 2 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> > index 62eab82a64f9..daff9a2af3be 100644
> > --- a/drivers/gpu/drm/radeon/cik.c
> > +++ b/drivers/gpu/drm/radeon/cik.c
> > @@ -221,9 +221,7 @@ int ci_get_temp(struct radeon_device *rdev)
> > else
> > actual_temp = temp & 0x1ff;
> >
> > - actual_temp = actual_temp * 1000;
> > -
> > - return actual_temp;
> > + return actual_temp * 1000;
> > }
> >
> > /* get temperature in millidegrees */
> > @@ -239,9 +237,7 @@ int kv_get_temp(struct radeon_device *rdev)
> > else
> > actual_temp = 0;
> >
> > - actual_temp = actual_temp * 1000;
> > -
> > - return actual_temp;
> > + return actual_temp * 1000;
> > }
> >
> > /*
> >
> _______________________________________________
> amd-gfx mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx