Skip to contentSkip to conversation

drm/ttm: cleanup unuse ret value

PATCH In review Huang Rui 2 participants 3 messages Apr 17, 2017 – Apr 18, 2017

Subsystems (3)
lore
Share & tools
lore

Huang Rui

author
#0 lore raw

PATCH 1/1 drm/ttm: cleanup unuse ret value

The ret must be 0 here, otherwise, the function will return after init_mem_type.

---
 drivers/gpu/drm/ttm/ttm_bo.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -1
index 9ee4ff4..5dcb4e1 100644
@@ -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)
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Huang Rui

The ret must be 0 here, otherwise, the function will return after init_mem_type.

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

Quoted 19 lines
---
 drivers/gpu/drm/ttm/ttm_bo.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -2
index 9ee4ff4..5dcb4e1 100644
@@ -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

Quoted 4 lines

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

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

author
#2 lore raw
Quoted 10 lines · Alex Deucher
Quoted 1 line · Huang Rui

The ret must be 0 here, otherwise, the function will return after

init_mem_type.

Quoted 2 lines

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

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

Thanks,
Rui
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel