Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4523813 authored by Hanumant Singh's avatar Hanumant Singh Committed by Gerrit - the friendly Code Review server
Browse files

esoc: Add check for possible null pointer returns



The call to kasprintf() can fail, with a failure to
allocate memory. Handle the condition appropriately.

CRs-Fixed: 1014400
Change-Id: I83d3a6c8bdfd7a104b88a3bedd50f49faeecd97a
Signed-off-by: default avatarHanumant Singh <hanumant@codeaurora.org>
parent fcf1fb67
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -47,6 +47,8 @@ struct esoc_desc *devm_register_esoc_client(struct device *dev,

	for (index = 0;; index++) {
		esoc_prop = kasprintf(GFP_KERNEL, "esoc-%d", index);
		if (IS_ERR_OR_NULL(esoc_prop))
			return ERR_PTR(-ENOMEM);
		parp = of_get_property(np, esoc_prop, NULL);
		if (parp == NULL) {
			dev_err(dev, "esoc device not present\n");