2020-12-15 02:52:53

by Tian Tao

[permalink] [raw]
Subject: [PATCH] dma-buf: system_heap: Use PTR_ERR_OR_ZERO() to simplify code

Fixes coccicheck warning:
drivers/dma-buf/heaps/system_heap.c:437:1-3: WARNING: PTR_ERR_OR_ZERO
can be used

Signed-off-by: Tian Tao <[email protected]>
---
drivers/dma-buf/heaps/system_heap.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
index 17e0e9a..c5d8a40 100644
--- a/drivers/dma-buf/heaps/system_heap.c
+++ b/drivers/dma-buf/heaps/system_heap.c
@@ -434,10 +434,8 @@ static int system_heap_create(void)
exp_info.priv = NULL;

sys_heap = dma_heap_add(&exp_info);
- if (IS_ERR(sys_heap))
- return PTR_ERR(sys_heap);

- return 0;
+ return PTR_ERR_OR_ZERO(sys_heap);
}
module_init(system_heap_create);
MODULE_LICENSE("GPL v2");
--
2.7.4