[snip]

>> +
>> +static void cxl_add_protocol_errors(struct cxl_ctx *ctx)
>> +{
>> +    struct cxl_protocol_error *perror;
>> +    char buf[SYSFS_ATTR_SIZE];
>> +    char *path, *num, *save;
>> +    size_t path_len, len;
>> +    unsigned long n;
>> +    int rc = 0;
>> +
>> +    if (!ctx->debugfs)
>> +            return;
>> +
>> +    path_len = strlen(ctx->debugfs) + 100;
>> +    path = calloc(1, path_len);
>> +    if (!path)
>> +            return;
>> +
>> +    len = snprintf(path, path_len, "%s/cxl/einj_types", ctx->debugfs);
>> +    if (len >= path_len) {
>> +            err(ctx, "Buffer too small\n");
>> +            goto err;
>> +    }
>> +
>> +    rc = access(path, F_OK);
>> +    if (rc) {
>> +            err(ctx, "failed to access %s: %s\n", path, strerror(errno));
>> +            goto err;
>> +    }
>> +
>> +    rc = sysfs_read_attr(ctx, path, buf);
>> +    if (rc) {
>> +            err(ctx, "failed to read %s: %s\n", path, strerror(errno));
> 
> sysfs_read_attr() is a local lib function and not glibc. It returns -errno 
> and does not set errno. See util/sysfs.c.
> 

Yep, that was me being lazy and not paying attention. Will this (and the one 
below) for v5.

Thanks,
Ben


Reply via email to