drm/ttm: cleanup unuse ret value

Submitted by Huang, Ray on April 17, 2017, 7:38 a.m.

Details

Message ID 1492414731-2141-1-git-send-email-ray.huang@amd.com
State New
Headers show
Series "drm/ttm: cleanup unuse ret value" ( rev: 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

Huang, Ray April 17, 2017, 7:38 a.m.
The ret must be 0 here, otherwise, the function will return after init_mem_type.

Signed-off-by: Huang Rui <ray.huang@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 1 -
 1 file changed, 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 9ee4ff4..5dcb4e1 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1440,7 +1440,6 @@  int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
 		return ret;
 	man->bdev = bdev;
 
-	ret = 0;
 	if (type != TTM_PL_SYSTEM) {
 		ret = (*man->func->init)(man, p_size);
 		if (ret)

Comments

On Mon, Apr 17, 2017 at 3:38 AM, Huang Rui <ray.huang@amd.com> wrote:
> The ret must be 0 here, otherwise, the function will return after init_mem_type.
>
> Signed-off-by: Huang Rui <ray.huang@amd.com>

I think you can drop the initial assignment of ret as well.  Either way:

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/ttm/ttm_bo.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 9ee4ff4..5dcb4e1 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -1440,7 +1440,6 @@ int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
>                 return ret;
>         man->bdev = bdev;
>
> -       ret = 0;
>         if (type != TTM_PL_SYSTEM) {
>                 ret = (*man->func->init)(man, p_size);
>                 if (ret)
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
On Mon, Apr 17, 2017 at 11:42:18PM +0800, Alex Deucher wrote:
> On Mon, Apr 17, 2017 at 3:38 AM, Huang Rui <ray.huang@amd.com> wrote:
> > The ret must be 0 here, otherwise, the function will return after
> init_mem_type.
> >
> > Signed-off-by: Huang Rui <ray.huang@amd.com>
> 
> I think you can drop the initial assignment of ret as well.  Either way:
> 
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> 

Yep, we needn't set ret as EINVAL at first, because it must be assigned
before return.

Thanks,
Rui