devm_extcon_dev_allocate() can fail of multiple reasons.  The call
returns proper error code on failure so pass it instead of fixed ENOMEM.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
 drivers/extcon/extcon-max8997.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 172e116ac1ce..337b0eea4e62 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -674,7 +674,7 @@ static int max8997_muic_probe(struct platform_device *pdev)
        info->edev = devm_extcon_dev_allocate(&pdev->dev, max8997_extcon_cable);
        if (IS_ERR(info->edev)) {
                dev_err(&pdev->dev, "failed to allocate memory for extcon\n");
-               ret = -ENOMEM;
+               ret = PTR_ERR(info->edev);
                goto err_irq;
        }
 
-- 
2.17.1

Reply via email to