staging: most: dim2: use if statements instead of ?: expressions
authorNikita Yushchenko <nikita.yoush@cogentembedded.com>
Mon, 27 Sep 2021 16:06:49 +0000 (19:06 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Sep 2021 07:11:26 +0000 (09:11 +0200)
For better maintainability, replace conditional expressions with if
statements in the drivers' probe routine.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Link: https://lore.kernel.org/r/20210927160649.29209-1-nikita.yoush@cogentembedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/dim2/dim2.c

index 9300040ec84cb9883de78460159d97f7720b5bbf..e8b03fa90e807c1932690cbfdcdbcc9cd21eb5e5 100644 (file)
@@ -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);