Messages in this thread Patch in this message | | | From | Chanwoo Choi <> | Subject | [RESEND PATCHv2] charger-manager: Fix checking of wrong return type | Date | Fri, 28 Mar 2014 09:51:27 +0900 |
| |
This patch fix minor issue about checking wrong return type.
The of_cm_parse_desc() return ERR_PTR(errnor number) when some error happen in this function. But, charger_manager_probe() has only checked whether desc is NULL or not. If of_cm_parse_desc() returns ERR_PTR(-ENOMEM), desc isn't NULL but desc is (void *)(-ENOMEM). Althouhg some error happen for parsing DT, charger_manager_probe() can't detect error of desc instance.
Changes from v1: - Fix return value from -ENODEV to PTR_ERR(desc)
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> --- drivers/power/charger-manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index 9e4dab4..cf40fa1 100644 --- a/drivers/power/charger-manager.c +++ b/drivers/power/charger-manager.c @@ -1677,9 +1677,9 @@ static int charger_manager_probe(struct platform_device *pdev) } } - if (!desc) { + if (IS_ERR(desc)) { dev_err(&pdev->dev, "No platform data (desc) found\n"); - return -ENODEV; + return PTR_ERR(desc); } cm = devm_kzalloc(&pdev->dev, -- 1.8.0
| |