Message ID | 1521191452-30089-1-git-send-email-mgautam@codeaurora.org (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Hi Manu, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on v4.16-rc4] [also build test WARNING on next-20180316] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Manu-Gautam/phy-core-Allow-phy_pm_runtime_xxx-API-calls-with-NULL-phy/20180317-114302 config: x86_64-randconfig-x002-201810 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): drivers/phy/phy-core.c: In function 'phy_pm_runtime_allow': >> drivers/phy/phy-core.c:215:10: warning: 'return' with a value, in function returning void return 0; ^ drivers/phy/phy-core.c:212:6: note: declared here void phy_pm_runtime_allow(struct phy *phy) ^~~~~~~~~~~~~~~~~~~~ drivers/phy/phy-core.c: In function 'phy_pm_runtime_forbid': drivers/phy/phy-core.c:227:10: warning: 'return' with a value, in function returning void return 0; ^ drivers/phy/phy-core.c:224:6: note: declared here void phy_pm_runtime_forbid(struct phy *phy) ^~~~~~~~~~~~~~~~~~~~~ vim +/return +215 drivers/phy/phy-core.c 211 212 void phy_pm_runtime_allow(struct phy *phy) 213 { 214 if (!phy) > 215 return 0; 216 217 if (!pm_runtime_enabled(&phy->dev)) 218 return; 219 220 pm_runtime_allow(&phy->dev); 221 } 222 EXPORT_SYMBOL_GPL(phy_pm_runtime_allow); 223 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
On 2018-03-16 14:40, Manu Gautam wrote: > phy_init() and phy_exit() calls, and phy_power_on() and > phy_power_off() already accept NULL as valid PHY refernece > and act as NOP. Extend same concept to phy runtime_pm APIs > to keep drivers (e.g. dwc3) code simple while dealing with > optional PHYs. > > Signed-off-by: Manu Gautam <mgautam@codeaurora.org> > --- > drivers/phy/phy-core.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c > index 09ac8af..48b9615 100644 > --- a/drivers/phy/phy-core.c > +++ b/drivers/phy/phy-core.c > @@ -153,6 +153,9 @@ int phy_pm_runtime_get(struct phy *phy) > { > int ret; > > + if (!phy) > + return 0; > + > if (!pm_runtime_enabled(&phy->dev)) Were we already trying to dereference a NULL here? That shouldn't be good i guess. Kishon, do we not expect phys to be NULL here? <snip> regards Vivek -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 09ac8af..48b9615 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -153,6 +153,9 @@ int phy_pm_runtime_get(struct phy *phy) { int ret; + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return -ENOTSUPP; @@ -168,6 +171,9 @@ int phy_pm_runtime_get_sync(struct phy *phy) { int ret; + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return -ENOTSUPP; @@ -181,6 +187,9 @@ int phy_pm_runtime_get_sync(struct phy *phy) int phy_pm_runtime_put(struct phy *phy) { + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return -ENOTSUPP; @@ -190,6 +199,9 @@ int phy_pm_runtime_put(struct phy *phy) int phy_pm_runtime_put_sync(struct phy *phy) { + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return -ENOTSUPP; @@ -199,6 +211,9 @@ int phy_pm_runtime_put_sync(struct phy *phy) void phy_pm_runtime_allow(struct phy *phy) { + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return; @@ -208,6 +223,9 @@ void phy_pm_runtime_allow(struct phy *phy) void phy_pm_runtime_forbid(struct phy *phy) { + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return;
phy_init() and phy_exit() calls, and phy_power_on() and phy_power_off() already accept NULL as valid PHY refernece and act as NOP. Extend same concept to phy runtime_pm APIs to keep drivers (e.g. dwc3) code simple while dealing with optional PHYs. Signed-off-by: Manu Gautam <mgautam@codeaurora.org> --- drivers/phy/phy-core.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)