[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220401033335.16881-1-guozhengkui@vivo.com>
Date: Fri, 1 Apr 2022 11:33:23 +0800
From: Guo Zhengkui <guozhengkui@...o.com>
To: Mauro Carvalho Chehab <mchehab@...nel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Guo Zhengkui <guozhengkui@...o.com>,
linux-media@...r.kernel.org (open list:STAGING - ATOMISP DRIVER),
linux-staging@...ts.linux.dev (open list:STAGING SUBSYSTEM),
linux-kernel@...r.kernel.org (open list)
Cc: zhengkui_guo@...look.com
Subject: [PATCH] media: atomisp: simplify if-if to if-else
Replace `if (!ret)` with `else` for simplification and add curly
brackets according to the kernel coding style:
"Do not unnecessarily use braces where a single statement will do."
...
"This does not apply if only one branch of a conditional statement is
a single statement; in the latter case use braces in both branches"
Please refer to:
https://www.kernel.org/doc/html/v5.17-rc8/process/coding-style.html
Signed-off-by: Guo Zhengkui <guozhengkui@...o.com>
---
drivers/staging/media/atomisp/pci/hmm/hmm_bo.c | 4 ++--
.../staging/media/atomisp/pci/hmm/hmm_dynamic_pool.c | 12 ++++++------
.../media/atomisp/pci/hmm/hmm_reserved_pool.c | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c
index 0168f9839c90..ee7805c9d4e5 100644
--- a/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c
@@ -668,7 +668,7 @@ static void free_private_bo_pages(struct hmm_buffer_object *bo,
*/
default:
ret = set_pages_wb(bo->page_obj[i].page, 1);
- if (ret)
+ if (ret) {
dev_err(atomisp_dev,
"set page to WB err ...ret = %d\n",
ret);
@@ -679,7 +679,7 @@ static void free_private_bo_pages(struct hmm_buffer_object *bo,
then, _free_pages would panic; Do not know why page
address be valid,it maybe memory corruption by lowmemory
*/
- if (!ret) {
+ } else {
__free_pages(bo->page_obj[i].page, 0);
hmm_mem_stat.sys_size--;
}
diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm_dynamic_pool.c b/drivers/staging/media/atomisp/pci/hmm/hmm_dynamic_pool.c
index eaf97e5f3b68..44b05b87f3ea 100644
--- a/drivers/staging/media/atomisp/pci/hmm/hmm_dynamic_pool.c
+++ b/drivers/staging/media/atomisp/pci/hmm/hmm_dynamic_pool.c
@@ -94,7 +94,7 @@ static void free_pages_to_dynamic_pool(void *pool,
if (dypool_info->pgnr >= dypool_info->pool_size) {
/* free page directly back to system */
ret = set_pages_wb(page_obj->page, 1);
- if (ret)
+ if (ret) {
dev_err(atomisp_dev,
"set page to WB err ...ret=%d\n", ret);
/*
@@ -104,7 +104,7 @@ static void free_pages_to_dynamic_pool(void *pool,
then, _free_pages would panic; Do not know why page
address be valid, it maybe memory corruption by lowmemory
*/
- if (!ret) {
+ } else {
__free_pages(page_obj->page, 0);
hmm_mem_stat.sys_size--;
}
@@ -115,10 +115,10 @@ static void free_pages_to_dynamic_pool(void *pool,
if (!hmm_page) {
/* free page directly */
ret = set_pages_wb(page_obj->page, 1);
- if (ret)
+ if (ret) {
dev_err(atomisp_dev,
"set page to WB err ...ret=%d\n", ret);
- if (!ret) {
+ } else {
__free_pages(page_obj->page, 0);
hmm_mem_stat.sys_size--;
}
@@ -194,10 +194,10 @@ static void hmm_dynamic_pool_exit(void **pool)
/* can cause thread sleep, so cannot be put into spin_lock */
ret = set_pages_wb(hmm_page->page, 1);
- if (ret)
+ if (ret) {
dev_err(atomisp_dev,
"set page to WB err...ret=%d\n", ret);
- if (!ret) {
+ } else {
__free_pages(hmm_page->page, 0);
hmm_mem_stat.dyc_size--;
hmm_mem_stat.sys_size--;
diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm_reserved_pool.c b/drivers/staging/media/atomisp/pci/hmm/hmm_reserved_pool.c
index 57525fece921..8b424217095f 100644
--- a/drivers/staging/media/atomisp/pci/hmm/hmm_reserved_pool.c
+++ b/drivers/staging/media/atomisp/pci/hmm/hmm_reserved_pool.c
@@ -224,7 +224,7 @@ static void hmm_reserved_pool_exit(void **pool)
then, _free_pages would panic; Do not know why
page address be valid, it maybe memory corruption by lowmemory
*/
- if (!ret)
+ else
__free_pages(repool_info->pages[i], 0);
}
--
2.20.1
Powered by blists - more mailing lists