From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751511AbdH3OEY (ORCPT ); Wed, 30 Aug 2017 10:04:24 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:51824 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbdH3OEV (ORCPT ); Wed, 30 Aug 2017 10:04:21 -0400 Date: Wed, 30 Aug 2017 17:03:58 +0300 From: Dan Carpenter To: Support Opensource Cc: Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] regulator: da9063: Return an error code on probe failure Message-ID: <20170830140358.k3i3rehnrtdrys4t@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170609 (1.8.3) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If "regl_pdata->n_regulators == 0" is true then we accidentally return PTR_ERR() instead of an error code. I've changed it to return -ENODEV instead. Fixes: 69ca3e58d178 ("regulator: da9063: Add Dialog DA9063 voltage regulators support.") Signed-off-by: Dan Carpenter diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index c6af343f54ea..6a8f9cd69f52 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c @@ -736,7 +736,7 @@ static int da9063_regulator_probe(struct platform_device *pdev) if (IS_ERR(regl_pdata) || regl_pdata->n_regulators == 0) { dev_err(&pdev->dev, "No regulators defined for the platform\n"); - return PTR_ERR(regl_pdata); + return -ENODEV; } /* Find regulators set for particular device model */ From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Wed, 30 Aug 2017 14:03:58 +0000 Subject: [PATCH] regulator: da9063: Return an error code on probe failure Message-Id: <20170830140358.k3i3rehnrtdrys4t@mwanda> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Support Opensource Cc: Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org If "regl_pdata->n_regulators = 0" is true then we accidentally return PTR_ERR() instead of an error code. I've changed it to return -ENODEV instead. Fixes: 69ca3e58d178 ("regulator: da9063: Add Dialog DA9063 voltage regulators support.") Signed-off-by: Dan Carpenter diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index c6af343f54ea..6a8f9cd69f52 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c @@ -736,7 +736,7 @@ static int da9063_regulator_probe(struct platform_device *pdev) if (IS_ERR(regl_pdata) || regl_pdata->n_regulators = 0) { dev_err(&pdev->dev, "No regulators defined for the platform\n"); - return PTR_ERR(regl_pdata); + return -ENODEV; } /* Find regulators set for particular device model */