lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 23 Apr 2013 14:15:41 +0300
From:	Felipe Balbi <balbi@...com>
To:	Kishon Vijay Abraham I <kishon@...com>
CC:	Vivek Gautam <gautamvivek1987@...il.com>, <balbi@...com>,
	Vivek Gautam <gautam.vivek@...sung.com>,
	<linux-usb@...r.kernel.org>, <linux-samsung-soc@...r.kernel.org>,
	<linux-omap@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<gregkh@...uxfoundation.org>, <stern@...land.harvard.edu>,
	<sarah.a.sharp@...ux.intel.com>, <rob.herring@...xeda.com>,
	<kgene.kim@...sung.com>, <dianders@...omium.org>,
	<t.figa@...sung.com>, <p.paneri@...sung.com>
Subject: Re: [PATCH v3 01/11] usb: phy: Add APIs for runtime power management

Hi,

On Thu, Apr 18, 2013 at 05:20:11PM +0530, Kishon Vijay Abraham I wrote:
> >>>>>Adding  APIs to handle runtime power management on PHY
> >>>>>devices. PHY consumers may need to wake-up/suspend PHYs
> >>>>>when they work across autosuspend.
> >>>>>
> >>>>>Signed-off-by: Vivek Gautam <gautam.vivek@...sung.com>
> >>>>>---
> >>>>>  include/linux/usb/phy.h |  141 +++++++++++++++++++++++++++++++++++++++++++++++
> >>>>>  1 files changed, 141 insertions(+), 0 deletions(-)
> >>>>>
> >>>>>diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
> >>>>>index 6b5978f..01bf9c1 100644
> >>>>>--- a/include/linux/usb/phy.h
> >>>>>+++ b/include/linux/usb/phy.h
> >>>>>@@ -297,4 +297,145 @@ static inline const char *usb_phy_type_string(enum usb_phy_type type)
> >>>>>               return "UNKNOWN PHY TYPE";
> >>>>>       }
> >>>>>  }
> >>>>>+
> >>>>>+static inline void usb_phy_autopm_enable(struct usb_phy *x)
> >>>>>+{
> >>>>>+     if (!x || !x->dev) {
> >>>>>+             dev_err(x->dev, "no PHY or attached device available\n");
> >>>>>+             return;
> >>>>>+             }
> >>>>
> >>>>wrong indentation, also, I'm not sure we should allow calls with NULL
> >>>>pointers. Perhaps a WARN() so we get API offenders early enough ?
> >>>
> >>>True, bad coding style :-(
> >>>We should be handling dev_err with a NULL pointer.
> >>>Will just keep here:
> >>>if (WARN_ON(!x->dev))
> >>>       return .... ;
> >>
> >>right, but I guess:
> >>
> >>if (WARN(!x || !x->dev, "Invalid parameters\n"))
> >>         return -EINVAL;
> >>
> >>would be better ??
> 
> btw, shouldn't it be IS_ERR(x)?

not in this case, since we're trying to catch users passing NULL to as
the phy argument.

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists