From: Ladislav Michl Date: Wed, 21 Mar 2018 15:50:00 +0000 (+0100) Subject: power: supply: charger-manager: Verify polling interval only when polling requested X-Git-Tag: v4.18-rc1~77^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=111242d6e1aa0cbdf1dd91fff6f210ae0d4d01bc;p=thirdparty%2Fkernel%2Flinux.git power: supply: charger-manager: Verify polling interval only when polling requested Driver bails out with -EINVAL when no polling specififaion is requested. Fix that by verifing polling interval only if polling_mode is different from CM_POLL_DISABLE. Signed-off-by: Ladislav Michl Signed-off-by: Sebastian Reichel --- diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c index 1de4b44938241..2a50b46547930 100644 --- a/drivers/power/supply/charger-manager.c +++ b/drivers/power/supply/charger-manager.c @@ -1700,8 +1700,9 @@ static int charger_manager_probe(struct platform_device *pdev) power_supply_put(psy); } - if (desc->polling_interval_ms == 0 || - msecs_to_jiffies(desc->polling_interval_ms) <= CM_JIFFIES_SMALL) { + if (cm->desc->polling_mode != CM_POLL_DISABLE && + (desc->polling_interval_ms == 0 || + msecs_to_jiffies(desc->polling_interval_ms) <= CM_JIFFIES_SMALL)) { dev_err(&pdev->dev, "polling_interval_ms is too small\n"); return -EINVAL; }