From: Markus Elfring Date: Thu, 3 Oct 2024 19:38:45 +0000 (+0200) Subject: media: i2c: tda1997x: Call of_node_put(ep) only once in tda1997x_parse_dt() X-Git-Tag: v6.15-rc1~174^2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b50231ff015ee223732a4783eda954609369076c;p=thirdparty%2Fkernel%2Flinux.git media: i2c: tda1997x: Call of_node_put(ep) only once in tda1997x_parse_dt() An of_node_put(ep) call was immediately used after a return value check for a v4l2_fwnode_endpoint_parse() call in this function implementation. Thus call such a function only once instead directly before the check. This issue was transformed by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Hans Verkuil --- diff --git a/drivers/media/i2c/tda1997x.c b/drivers/media/i2c/tda1997x.c index 3b7e5ff5b010b..959590afc80fc 100644 --- a/drivers/media/i2c/tda1997x.c +++ b/drivers/media/i2c/tda1997x.c @@ -2315,11 +2315,10 @@ static int tda1997x_parse_dt(struct tda1997x_state *state) return -EINVAL; ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &bus_cfg); - if (ret) { - of_node_put(ep); - return ret; - } of_node_put(ep); + if (ret) + return ret; + pdata->vidout_bus_type = bus_cfg.bus_type; /* polarity of HS/VS/DE */