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/core.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 3dbb4a2..dabd7b4 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -1169,10 +1169,8 @@ static int ci_suspend(struct device *dev)
        if (ci->in_lpm)
                pm_runtime_resume(dev);
 
-       if (ci->in_lpm) {
-               WARN_ON(1);
+       if (WARN_ON(ci->in_lpm))
                return 0;
-       }
 
        if (device_may_wakeup(dev)) {
                if (ci_otg_is_fsm_mode(ci))
@@ -1215,10 +1213,8 @@ static int ci_runtime_suspend(struct device *dev)
 
        dev_dbg(dev, "at %s\n", __func__);
 
-       if (ci->in_lpm) {
-               WARN_ON(1);
+       if (WARN_ON(ci->in_lpm))
                return 0;
-       }
 
        if (ci_otg_is_fsm_mode(ci))
                ci_otg_fsm_suspend_for_srp(ci);
-- 
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