aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/ti-st
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2015-05-12 17:37:23 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-24 15:16:47 -0400
commit0810f18fce92afc827d5c7c1d4f146b72b8052d6 (patch)
tree22238cdc857e4a721feb44094c4db3fe8485bae3 /drivers/misc/ti-st
parent4b6fda0b809cca084b23c0842d713ba1d9c686da (diff)
ti-st: handle null allocation return correctly.
static analysis with smatch picked up the following error: get_platform_data() error: potential null dereference 'dt_pdata'. (kzalloc returns null) Instead, the code should return NULL to avoid the following null pointer deference. Also, remove the error message as it is redundant, the caller emits an error message to alert of a failure anyhow. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/ti-st')
-rw-r--r--drivers/misc/ti-st/st_kim.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 18e7a03985d4..5027b8ffae43 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -752,9 +752,8 @@ static struct ti_st_plat_data *get_platform_data(struct device *dev)
752 int len; 752 int len;
753 753
754 dt_pdata = kzalloc(sizeof(*dt_pdata), GFP_KERNEL); 754 dt_pdata = kzalloc(sizeof(*dt_pdata), GFP_KERNEL);
755
756 if (!dt_pdata) 755 if (!dt_pdata)
757 pr_err("Can't allocate device_tree platform data\n"); 756 return NULL;
758 757
759 dt_property = of_get_property(np, "dev_name", &len); 758 dt_property = of_get_property(np, "dev_name", &len);
760 if (dt_property) 759 if (dt_property)