summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Iacobucci <alexiacobucci@google.com>2023-07-06 15:21:52 +0000
committerAlex Iacobucci <alexiacobucci@google.com>2023-07-06 21:44:06 +0000
commitb77479e731fad288563b7125e6889fec66a2b191 (patch)
tree61598f5b1d435c5612496b5fc27be5cf475f88fe
parent17e0e8efc3a2c08836d103fdaf09fa8d63203e4b (diff)
downloadaoc-b77479e731fad288563b7125e6889fec66a2b191.tar.gz
aoc: add check on kzalloc
Bug: 289710588 Test: tested on device Change-Id: I89a5f62cfa80e21479e6b62bc722ddf6c5e97513 Signed-off-by: Alex Iacobucci <alexiacobucci@google.com>
-rw-r--r--aoc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/aoc.c b/aoc.c
index 3a366f9..83bcfef 100644
--- a/aoc.c
+++ b/aoc.c
@@ -1990,6 +1990,8 @@ static struct aoc_service_dev *create_service_device(struct aoc_prvdata *prvdata
return NULL;
dev = kzalloc(sizeof(struct aoc_service_dev), GFP_KERNEL);
+ if (!dev)
+ return NULL;
prvdata->services[index] = dev;
name = aoc_service_name(s);
@@ -2271,7 +2273,10 @@ static void aoc_did_become_online(struct work_struct *work)
}
for (i = 0; i < s; i++) {
- create_service_device(prvdata, i);
+ if (!create_service_device(prvdata, i)) {
+ dev_err(prvdata->dev, "failed to create service device at index %d\n", i);
+ goto err;
+ }
}
aoc_state = AOC_STATE_ONLINE;