lkml.org 
[lkml]   [2021]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] staging: most: dim2: use if statements instead of ?: expressions
Date
For better maintainability, replace conditional expressions with if
statements in the drivers' probe routine.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
---
drivers/staging/most/dim2/dim2.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index 9300040ec84c..e8b03fa90e80 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -732,7 +732,8 @@ static int dim2_probe(struct platform_device *pdev)
struct dim2_hdm *dev;
struct resource *res;
int ret, i;
- u8 dev_fcnt, hal_ret;
+ u8 hal_ret;
+ u8 dev_fcnt = fcnt;
int irq;

enum { MLB_INT_IDX, AHB0_INT_IDX };
@@ -765,16 +766,16 @@ static int dim2_probe(struct platform_device *pdev)

of_id = of_match_node(dim2_of_match, pdev->dev.of_node);
pdata = of_id->data;
- ret = pdata && pdata->enable ? pdata->enable(pdev) : 0;
- if (ret)
- return ret;
-
- dev->disable_platform = pdata ? pdata->disable : NULL;
-
- if (pdata && pdata->fcnt)
- dev_fcnt = pdata->fcnt;
- else
- dev_fcnt = fcnt;
+ if (pdata) {
+ if (pdata->enable) {
+ ret = pdata->enable(pdev);
+ if (ret)
+ return ret;
+ }
+ dev->disable_platform = pdata->disable;
+ if (pdata->fcnt)
+ dev_fcnt = pdata->fcnt;
+ }

dev_info(&pdev->dev, "sync: num of frames per sub-buffer: %u\n",
dev_fcnt);
--
2.30.2
\
 
 \ /
  Last update: 2021-09-27 18:07    [W:0.068 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site