|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v11 06/23] x86: refactor psr: L3 CAT: implement get hw info flow.
>>> On 03.05.17 at 10:44, <yi.y.sun@xxxxxxxxxxxxxxx> wrote:
> +int psr_get_info(unsigned int socket, enum cbm_type type,
> + uint32_t data[], unsigned int array_len)
> +{
> + const struct psr_socket_info *info = get_socket_info(socket);
> + const struct feat_node *feat;
> + enum psr_feat_type feat_type;
> +
> + ASSERT(data);
> +
> + if ( IS_ERR(info) )
> + return PTR_ERR(info);
> +
> + feat_type = psr_cbm_type_to_feat_type(type);
> + if ( feat_type >= ARRAY_SIZE(info->features) )
> + return -ENOENT;
> +
> + feat = info->features[feat_type];
> + if ( !feat || !feat_props[feat_type] )
> + return -ENOENT;
Isn't it a bug if feat_props[feat_type] is NULL when feat here is
non-NULL? If so, perhaps the better approach would be to have
separate checks:
if ( !feat )
return -ENOENT;
if ( !feat_props[feat_type] )
{
ASSERT_UNREACHABLE();
return -ENOENT;
}
at once documenting this interdependency.
With or without this change
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |