if (value < 0)
return -ENOENT;
- return snprintf(buf, buf ? PAGE_SIZE : 0, "0x%06x\n", value);
+ return snprintf(buf, PAGE_SIZE, "0x%06x\n", value);
}
#define IMMEDIATE_ATTR(name, key) \
struct config_rom_attribute *attr =
container_of(dattr, struct config_rom_attribute, attr);
const u32 *directories[] = {NULL, NULL};
- size_t bufsize;
- char dummy_buf[2];
int i, ret = -ENOENT;
down_read(&fw_device_rwsem);
}
}
- if (buf) {
- bufsize = PAGE_SIZE - 1;
- } else {
- buf = dummy_buf;
- bufsize = 1;
- }
-
for (i = 0; i < ARRAY_SIZE(directories) && !!directories[i]; ++i) {
- int result = fw_csr_string(directories[i], attr->key, buf, bufsize);
+ int result = fw_csr_string(directories[i], attr->key, buf,
+ PAGE_SIZE - 1);
// Detected.
if (result >= 0) {
ret = result;