On Fri, Dec 02, 2016 at 09:06:19AM +0000, Atul Raj wrote: > On 2 Dec 2016 2:18 p.m., "Atul Raj" <atul.r@xxxxxxxxxxx> 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 <atul.r@xxxxxxxxxxx> > > >--- > > > 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: linux-usb@xxxxxxxxxxxxxxx > > > > > 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. > Please wrap up 75 characters. > Maybe the patch I sent could be base64-encoded as per samsung mailing policy. > From now onwards I will use gmail(atulraj.nith@xxxxxxxxx) 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. > I am not sure If I can save your email correctly, would you send your patches again (cc USB ML), my nxp account doesn't support imap, so I can't save the patches using mutt, I use my gmail account to save USB ML patches. -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html