On 2 Dec 2016 2:18 p.m., "Atul Raj" <[email protected]> wrote:
 >
 >
 >  
 > >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 <[email protected]>
 > >---
> > drivers/usb/chipidea/core.c | 12 +++---------
> > 1 file changed, 3 insertions(+), 9 deletions(-)
 > >
 > >diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index
 > >3dbb4a2..1a43689 100644
 > >--- a/drivers/usb/chipidea/core.c
 > >+++ b/drivers/usb/chipidea/core.c
 > >@@ -1128,10 +1128,8 @@ static int ci_controller_resume(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;
 > >-        }
 > >
 > >         ci_hdrc_enter_lpm(ci, false);
 > >         if (ci->usb_phy) {
 > >@@ -1169,10 +1167,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 +1211,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);
 > >--
>  
 > please cc: [email protected]
 >  


Dear Peter

As I am a newbie, I have been instructed by greg k-h to first try to submit 
patches in staging drivers. So I am trying to submit some patches there. I had 
sent you the patch to review before greg asked me to do so. 

Maybe the patch I sent could be base64-encoded as per samsung mailing policy.
From now onwards I will use gmail([email protected]) till I get exception 
from encoding.

I am sorry for all the trouble.

I am cc:ing the patch to email address as asked by you.

Thanks

Reply via email to