On Wed, 25 Mar 2020 at 19:19, Philippe Mathieu-Daudé <[email protected]> wrote:
>
> Running the coccinelle script produced:
>
> $ spatch \
> --macro-file scripts/cocci-macro-file.h --include-headers \
> --sp-file
> scripts/coccinelle/object_property_missing_error_propagate.cocci \
> --keep-comments --smpl-spacing --dir hw
>
> [[manual check required: error_propagate() might be missing in
> object_property_set_link() hw/net/xilinx_axienet.c:969:4]]
>
> Add the missing error_propagate() after manual review.
>
> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
> ---
> hw/net/xilinx_axienet.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c
> index 704788811a..f11510a71e 100644
> --- a/hw/net/xilinx_axienet.c
> +++ b/hw/net/xilinx_axienet.c
> @@ -948,39 +948,42 @@ static NetClientInfo net_xilinx_enet_info = {
> static void xilinx_enet_realize(DeviceState *dev, Error **errp)
> {
> XilinxAXIEnet *s = XILINX_AXI_ENET(dev);
> XilinxAXIEnetStreamSlave *ds =
> XILINX_AXI_ENET_DATA_STREAM(&s->rx_data_dev);
> XilinxAXIEnetStreamSlave *cs = XILINX_AXI_ENET_CONTROL_STREAM(
>
> &s->rx_control_dev);
> Error *local_err = NULL;
>
> object_property_add_link(OBJECT(ds), "enet", "xlnx.axi-ethernet",
> (Object **) &ds->enet,
> object_property_allow_set_link,
> OBJ_PROP_LINK_STRONG,
> &local_err);
Again, Coccinelle seems to have not spotted the missing error check here...
> object_property_add_link(OBJECT(cs), "enet", "xlnx.axi-ethernet",
> (Object **) &cs->enet,
> object_property_allow_set_link,
> OBJ_PROP_LINK_STRONG,
> &local_err);
> if (local_err) {
> goto xilinx_enet_realize_fail;
> }
> object_property_set_link(OBJECT(ds), OBJECT(s), "enet", &local_err);
> + if (local_err) {
> + goto xilinx_enet_realize_fail;
> + }
> object_property_set_link(OBJECT(cs), OBJECT(s), "enet", &local_err);
> if (local_err) {
> goto xilinx_enet_realize_fail;
> }
thanks
-- PMM