All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ti-st: st_kim: use ERR_PTR(-ENOMEM) instead of NULL
@ 2015-06-24 10:24 Jürg Billeter
  2015-06-24 10:24 ` [PATCH 2/3] ti-st: st_kim: fix nshutdown_gpio in get_platform_data Jürg Billeter
  2015-06-24 10:24 ` [PATCH 3/3] ti-st: st_kim: use gpio_set_value_cansleep to fix warning Jürg Billeter
  0 siblings, 2 replies; 6+ messages in thread
From: Jürg Billeter @ 2015-06-24 10:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Gigi Joseph, Colin Ian King, linux-kernel, Jürg Billeter

This allows return of other error codes.

Signed-off-by: Jürg Billeter <j@bitron.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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-24 15:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 10:24 [PATCH 1/3] ti-st: st_kim: use ERR_PTR(-ENOMEM) instead of NULL Jürg Billeter
2015-06-24 10:24 ` [PATCH 2/3] ti-st: st_kim: fix nshutdown_gpio in get_platform_data Jürg Billeter
2015-06-24 15:31   ` Peter Hurley
2015-06-24 15:39     ` Jürg Billeter
2015-06-24 15:49       ` Peter Hurley
2015-06-24 10:24 ` [PATCH 3/3] ti-st: st_kim: use gpio_set_value_cansleep to fix warning Jürg Billeter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.