Instead of using:
if (cond) {
   WARN_ON(1);
   do_stuff();
}

Use a better pattern with WARN_ON() placed in if condition:

if (WARN_ON(cond))
   do_stuff();

Signed-off-by: Atul Raj <atu...@samsung.com>
---
 drivers/usb/chipidea/ci_hdrc_imx.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c 
b/drivers/usb/chipidea/ci_hdrc_imx.c
index 0991794..2228e44 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -374,10 +374,8 @@ static int imx_controller_resume(struct device *dev)
 
        dev_dbg(dev, "at %s\n", __func__);
 
-       if (!data->in_lpm) {
-               WARN_ON(1);
+       if (WARN_ON(!data->in_lpm))
                return 0;
-       }
 
        ret = imx_prepare_enable_clks(dev);
        if (ret)
@@ -442,10 +440,8 @@ static int ci_hdrc_imx_runtime_suspend(struct device *dev)
        struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
        int ret;
 
-       if (data->in_lpm) {
-               WARN_ON(1);
+       if (WARN_ON(data->in_lpm))
                return 0;
-       }
 
        ret = imx_usbmisc_set_wakeup(data->usbmisc_data, true);
        if (ret) {
-- 
2.10.2.windows.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to