Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

media: nxp: use cleanup __free(fwnode_handle) simplify code

Use cleanup __free(fwnode_handle) simplify code. No functional change.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patch.msgid.link/20260116-cam_cleanup-v4-3-29ce01640443@nxp.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Frank Li and committed by
Hans Verkuil
e001b3b1 078161dd

+16 -34
+8 -17
drivers/media/platform/nxp/imx-mipi-csis.c
··· 12 12 * 13 13 */ 14 14 15 + #include <linux/cleanup.h> 15 16 #include <linux/clk.h> 16 17 #include <linux/debugfs.h> 17 18 #include <linux/delay.h> ··· 1350 1349 .bus_type = V4L2_MBUS_CSI2_DPHY, 1351 1350 }; 1352 1351 struct v4l2_async_connection *asd; 1353 - struct fwnode_handle *ep; 1354 1352 unsigned int i; 1355 1353 int ret; 1356 1354 1357 1355 v4l2_async_subdev_nf_init(&csis->notifier, &csis->sd); 1358 1356 1359 - ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(csis->dev), 0, 0, 1360 - FWNODE_GRAPH_ENDPOINT_NEXT); 1357 + struct fwnode_handle *ep __free(fwnode_handle) = 1358 + fwnode_graph_get_endpoint_by_id(dev_fwnode(csis->dev), 0, 0, 1359 + FWNODE_GRAPH_ENDPOINT_NEXT); 1361 1360 if (!ep) 1362 1361 return -ENOTCONN; 1363 1362 1364 1363 ret = v4l2_fwnode_endpoint_parse(ep, &vep); 1365 1364 if (ret) 1366 - goto err_parse; 1365 + return ret; 1367 1366 1368 1367 for (i = 0; i < vep.bus.mipi_csi2.num_data_lanes; ++i) { 1369 1368 if (vep.bus.mipi_csi2.data_lanes[i] != i + 1) { 1370 1369 dev_err(csis->dev, 1371 1370 "data lanes reordering is not supported"); 1372 - ret = -EINVAL; 1373 - goto err_parse; 1371 + return -EINVAL; 1374 1372 } 1375 1373 } 1376 1374 ··· 1381 1381 1382 1382 asd = v4l2_async_nf_add_fwnode_remote(&csis->notifier, ep, 1383 1383 struct v4l2_async_connection); 1384 - if (IS_ERR(asd)) { 1385 - ret = PTR_ERR(asd); 1386 - goto err_parse; 1387 - } 1388 - 1389 - fwnode_handle_put(ep); 1384 + if (IS_ERR(asd)) 1385 + return PTR_ERR(asd); 1390 1386 1391 1387 csis->notifier.ops = &mipi_csis_notify_ops; 1392 1388 ··· 1391 1395 return ret; 1392 1396 1393 1397 return v4l2_async_register_subdev(&csis->sd); 1394 - 1395 - err_parse: 1396 - fwnode_handle_put(ep); 1397 - 1398 - return ret; 1399 1398 } 1400 1399 1401 1400 /* -----------------------------------------------------------------------------
+8 -17
drivers/media/platform/nxp/imx8mq-mipi-csi2.c
··· 6 6 */ 7 7 8 8 #include <linux/bitfield.h> 9 + #include <linux/cleanup.h> 9 10 #include <linux/clk.h> 10 11 #include <linux/clk-provider.h> 11 12 #include <linux/delay.h> ··· 718 717 .bus_type = V4L2_MBUS_CSI2_DPHY, 719 718 }; 720 719 struct v4l2_async_connection *asd; 721 - struct fwnode_handle *ep; 722 720 unsigned int i; 723 721 int ret; 724 722 725 723 v4l2_async_subdev_nf_init(&state->notifier, &state->sd); 726 724 727 - ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(state->dev), 0, 0, 728 - FWNODE_GRAPH_ENDPOINT_NEXT); 725 + struct fwnode_handle *ep __free(fwnode_handle) = 726 + fwnode_graph_get_endpoint_by_id(dev_fwnode(state->dev), 0, 0, 727 + FWNODE_GRAPH_ENDPOINT_NEXT); 729 728 if (!ep) 730 729 return -ENOTCONN; 731 730 732 731 ret = v4l2_fwnode_endpoint_parse(ep, &vep); 733 732 if (ret) 734 - goto err_parse; 733 + return ret; 735 734 736 735 for (i = 0; i < vep.bus.mipi_csi2.num_data_lanes; ++i) { 737 736 if (vep.bus.mipi_csi2.data_lanes[i] != i + 1) { 738 737 dev_err(state->dev, 739 738 "data lanes reordering is not supported"); 740 - ret = -EINVAL; 741 - goto err_parse; 739 + return -EINVAL; 742 740 } 743 741 } 744 742 ··· 749 749 750 750 asd = v4l2_async_nf_add_fwnode_remote(&state->notifier, ep, 751 751 struct v4l2_async_connection); 752 - if (IS_ERR(asd)) { 753 - ret = PTR_ERR(asd); 754 - goto err_parse; 755 - } 756 - 757 - fwnode_handle_put(ep); 752 + if (IS_ERR(asd)) 753 + return PTR_ERR(asd); 758 754 759 755 state->notifier.ops = &imx8mq_mipi_csi_notify_ops; 760 756 ··· 759 763 return ret; 760 764 761 765 return v4l2_async_register_subdev(&state->sd); 762 - 763 - err_parse: 764 - fwnode_handle_put(ep); 765 - 766 - return ret; 767 766 } 768 767 769 768 /* -----------------------------------------------------------------------------