Path: csiph.com!goblin2!goblin.stu.neva.ru!aioe.org!bofh.it!news.nic.it!robomod From: Dan Carpenter Newsgroups: linux.kernel Subject: [PATCH] regulator: da9063: Return an error code on probe failure Date: Wed, 30 Aug 2017 16:10:03 +0200 Message-ID: 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: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 20 Organization: linux.* mail to news gateway X-Original-Cc: Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org X-Original-Date: Wed, 30 Aug 2017 17:03:58 +0300 X-Original-Message-ID: <20170830140358.k3i3rehnrtdrys4t@mwanda> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1723367 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 */