Commit 0810f18f authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman

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: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4b6fda0b
...@@ -752,9 +752,8 @@ static struct ti_st_plat_data *get_platform_data(struct device *dev) ...@@ -752,9 +752,8 @@ static struct ti_st_plat_data *get_platform_data(struct device *dev)
int len; int len;
dt_pdata = kzalloc(sizeof(*dt_pdata), GFP_KERNEL); dt_pdata = kzalloc(sizeof(*dt_pdata), GFP_KERNEL);
if (!dt_pdata) if (!dt_pdata)
pr_err("Can't allocate device_tree platform data\n"); return NULL;
dt_property = of_get_property(np, "dev_name", &len); dt_property = of_get_property(np, "dev_name", &len);
if (dt_property) if (dt_property)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment