[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1435141446-27236-1-git-send-email-j@bitron.ch>
Date: Wed, 24 Jun 2015 12:24:04 +0200
From: Jürg Billeter <j@...ron.ch>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Gigi Joseph <gigi.joseph@...il.com>,
Colin Ian King <colin.king@...onical.com>,
linux-kernel@...r.kernel.org,
Jürg Billeter <j@...ron.ch>
Subject: [PATCH 1/3] ti-st: st_kim: use ERR_PTR(-ENOMEM) instead of NULL
This allows return of other error codes.
Signed-off-by: Jürg Billeter <j@...ron.ch>
---
drivers/misc/ti-st/st_kim.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 5027b8f..af71584 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -752,8 +752,11 @@ static struct ti_st_plat_data *get_platform_data(struct device *dev)
int len;
dt_pdata = kzalloc(sizeof(*dt_pdata), GFP_KERNEL);
- if (!dt_pdata)
- return NULL;
+
+ if (!dt_pdata) {
+ pr_err("Can't allocate device_tree platform data\n");
+ return ERR_PTR(-ENOMEM);
+ }
dt_property = of_get_property(np, "dev_name", &len);
if (dt_property)
@@ -773,10 +776,13 @@ static int kim_probe(struct platform_device *pdev)
struct ti_st_plat_data *pdata;
int err;
- if (pdev->dev.of_node)
+ if (pdev->dev.of_node) {
pdata = get_platform_data(&pdev->dev);
- else
+ if (IS_ERR(pdata))
+ return PTR_ERR(pdata);
+ } else {
pdata = pdev->dev.platform_data;
+ }
if (pdata == NULL) {
dev_err(&pdev->dev, "Platform Data is missing\n");
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists