Skip to content

Commit

Permalink
Merge branch 'for-74/coverity-fixes' into pending
Browse files Browse the repository at this point in the history
Fix a small handful of issues reported by scan.coverity.com for the
recent region management additions.
  • Loading branch information
stellarhopper committed Aug 23, 2022
2 parents 9a993ce + 934d2b3 commit c5213a1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cxl/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ static void walk_decoders(struct cxl_port *port, struct cxl_filter_params *p,
cxl_decoder_foreach(port, decoder) {
const char *devname = cxl_decoder_get_devname(decoder);
struct json_object *jchildregions = NULL;
struct json_object *jdecoder;
struct json_object *jdecoder = NULL;

if (!p->decoders)
goto walk_children;
Expand Down
4 changes: 3 additions & 1 deletion cxl/lib/libcxl.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ static void *add_cxl_region(void *parent, int id, const char *cxlregion_base)

region = calloc(1, sizeof(*region));
if (!region)
goto err;
goto err_path;

region->id = id;
region->ctx = ctx;
Expand Down Expand Up @@ -551,11 +551,13 @@ static void *add_cxl_region(void *parent, int id, const char *cxlregion_base)

list_add_sorted(&decoder->regions, region, list, region_start_cmp);

free(path);
return region;
err:
free(region->dev_path);
free(region->dev_buf);
free(region);
err_path:
free(path);
return NULL;
}
Expand Down
5 changes: 2 additions & 3 deletions cxl/region.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,8 @@ static int region_action(int argc, const char **argv, struct cxl_ctx *ctx,
continue;

cxl_decoder_foreach (port, decoder) {
decoder = util_cxl_decoder_filter(decoder,
param.root_decoder);
if (!decoder)
if (!util_cxl_decoder_filter(decoder,
param.root_decoder))
continue;
rc = decoder_region_action(p, decoder, action, count);
if (rc)
Expand Down

0 comments on commit c5213a1

Please sign in to comment.