Commit 0d24a49e authored by Borislav Petkov's avatar Borislav Petkov

EDAC/device: Sanitize edac_device_alloc_ctl_info() definition

Shorten argument names, correct formatting, sort local vars in reverse
x-mas tree order.

No functional changes.
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220310095254.1510-5-bp@alien8.de
parent 9fb9ce39
...@@ -47,18 +47,19 @@ static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev) ...@@ -47,18 +47,19 @@ static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev)
} }
#endif /* CONFIG_EDAC_DEBUG */ #endif /* CONFIG_EDAC_DEBUG */
struct edac_device_ctl_info *edac_device_alloc_ctl_info( /*
unsigned sz_private, * @off_val: zero, 1, or other based offset
char *edac_device_name, unsigned nr_instances, */
char *edac_block_name, unsigned nr_blocks, struct edac_device_ctl_info *
unsigned offset_value, /* zero, 1, or other based offset */ edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instances,
struct edac_dev_sysfs_block_attribute *attrib_spec, unsigned nr_attrib, char *blk_name, unsigned nr_blocks, unsigned off_val,
int device_index) struct edac_dev_sysfs_block_attribute *attrib_spec,
unsigned nr_attrib, int device_index)
{ {
struct edac_device_ctl_info *dev_ctl;
struct edac_device_instance *dev_inst, *inst;
struct edac_device_block *dev_blk, *blk_p, *blk;
struct edac_dev_sysfs_block_attribute *dev_attrib, *attrib_p, *attrib; struct edac_dev_sysfs_block_attribute *dev_attrib, *attrib_p, *attrib;
struct edac_device_block *dev_blk, *blk_p, *blk;
struct edac_device_instance *dev_inst, *inst;
struct edac_device_ctl_info *dev_ctl;
unsigned instance, block, attr; unsigned instance, block, attr;
void *pvt; void *pvt;
int err; int err;
...@@ -95,8 +96,8 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( ...@@ -95,8 +96,8 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
dev_ctl->attribs = dev_attrib; dev_ctl->attribs = dev_attrib;
} }
if (sz_private) { if (pvt_sz) {
pvt = kzalloc(sz_private, GFP_KERNEL); pvt = kzalloc(pvt_sz, GFP_KERNEL);
if (!pvt) if (!pvt)
goto free; goto free;
...@@ -111,7 +112,7 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( ...@@ -111,7 +112,7 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
dev_ctl->log_ue = 1; dev_ctl->log_ue = 1;
/* Name of this edac device */ /* Name of this edac device */
snprintf(dev_ctl->name, sizeof(dev_ctl->name),"%s", edac_device_name); snprintf(dev_ctl->name, sizeof(dev_ctl->name),"%s", dev_name);
/* Initialize every Instance */ /* Initialize every Instance */
for (instance = 0; instance < nr_instances; instance++) { for (instance = 0; instance < nr_instances; instance++) {
...@@ -122,15 +123,14 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( ...@@ -122,15 +123,14 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
inst->blocks = blk_p; inst->blocks = blk_p;
/* name of this instance */ /* name of this instance */
snprintf(inst->name, sizeof(inst->name), snprintf(inst->name, sizeof(inst->name), "%s%u", dev_name, instance);
"%s%u", edac_device_name, instance);
/* Initialize every block in each instance */ /* Initialize every block in each instance */
for (block = 0; block < nr_blocks; block++) { for (block = 0; block < nr_blocks; block++) {
blk = &blk_p[block]; blk = &blk_p[block];
blk->instance = inst; blk->instance = inst;
snprintf(blk->name, sizeof(blk->name), snprintf(blk->name, sizeof(blk->name),
"%s%d", edac_block_name, block+offset_value); "%s%d", blk_name, block + off_val);
edac_dbg(4, "instance=%d inst_p=%p block=#%d block_p=%p name='%s'\n", edac_dbg(4, "instance=%d inst_p=%p block=#%d block_p=%p name='%s'\n",
instance, inst, block, blk, blk->name); instance, inst, block, blk, blk->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment