Skip to content

Commit

Permalink
media: i2c: tvp5150: check return value of devm_kasprintf()
Browse files Browse the repository at this point in the history
devm_kasprintf() returns a pointer to dynamically allocated memory.
Pointer could be NULL in case allocation fails. Check pointer validity.
Identified with coccinelle (kmerr.cocci script).

Fixes: 0556f1d ("media: tvp5150: add input source selection of_graph support")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
  • Loading branch information
Claudiu Beznea authored and Mauro Carvalho Chehab committed Jul 14, 2023
1 parent 6e28afd commit 26ce705
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/media/i2c/tvp5150.c
Original file line number Diff line number Diff line change
Expand Up @@ -2068,6 +2068,10 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)
tvpc->ent.name = devm_kasprintf(dev, GFP_KERNEL, "%s %s",
v4l2c->name, v4l2c->label ?
v4l2c->label : "");
if (!tvpc->ent.name) {
ret = -ENOMEM;
goto err_free;
}
}

ep_np = of_graph_get_endpoint_by_regs(np, TVP5150_PAD_VID_OUT, 0);
Expand Down

0 comments on commit 26ce705

Please sign in to comment.