firewire: Always use parens with sizeof.
Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c
index b8404ee..636151a 100644
--- a/drivers/firewire/fw-card.c
+++ b/drivers/firewire/fw-card.c
@@ -75,7 +75,7 @@
* the version stored in the OHCI registers.
*/
- memset(config_rom, 0, sizeof config_rom);
+ memset(config_rom, 0, sizeof(config_rom));
config_rom[0] = BIB_CRC_LENGTH(4) | BIB_INFO_LENGTH(4) | BIB_CRC(0);
config_rom[1] = 0x31333934;
@@ -258,7 +258,7 @@
fw_send_request(card, &bmd.t, TCODE_LOCK_COMPARE_SWAP,
irm_id, generation,
SCODE_100, CSR_REGISTER_BASE + CSR_BUS_MANAGER_ID,
- &bmd.lock, sizeof bmd.lock,
+ &bmd.lock, sizeof(bmd.lock),
complete_bm_lock, &bmd);
wait_for_completion(&bmd.done);
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c
index c876ac3..0fa5bd5 100644
--- a/drivers/firewire/fw-cdev.c
+++ b/drivers/firewire/fw-cdev.c
@@ -110,7 +110,7 @@
if (device == NULL)
return -ENODEV;
- client = kzalloc(sizeof *client, GFP_KERNEL);
+ client = kzalloc(sizeof(*client), GFP_KERNEL);
if (client == NULL)
return -ENOMEM;
@@ -233,7 +233,7 @@
{
struct bus_reset *bus_reset;
- bus_reset = kzalloc(sizeof *bus_reset, GFP_ATOMIC);
+ bus_reset = kzalloc(sizeof(*bus_reset), GFP_ATOMIC);
if (bus_reset == NULL) {
fw_notify("Out of memory when allocating bus reset event\n");
return;
@@ -242,7 +242,7 @@
fill_bus_reset_event(&bus_reset->reset, client);
queue_event(client, &bus_reset->event,
- &bus_reset->reset, sizeof bus_reset->reset, NULL, 0);
+ &bus_reset->reset, sizeof(bus_reset->reset), NULL, 0);
}
void fw_device_cdev_update(struct fw_device *device)
@@ -284,7 +284,7 @@
void __user *uptr = u64_to_uptr(get_info->bus_reset);
fill_bus_reset_event(&bus_reset, client);
- if (copy_to_user(uptr, &bus_reset, sizeof bus_reset))
+ if (copy_to_user(uptr, &bus_reset, sizeof(bus_reset)))
return -EFAULT;
}
@@ -361,7 +361,7 @@
response->response.type = FW_CDEV_EVENT_RESPONSE;
response->response.rcode = rcode;
queue_event(client, &response->event,
- &response->response, sizeof response->response,
+ &response->response, sizeof(response->response),
response->response.data, response->response.length);
}
@@ -375,7 +375,7 @@
if (request->length > 4096)
return -EINVAL;
- response = kmalloc(sizeof *response + request->length, GFP_KERNEL);
+ response = kmalloc(sizeof(*response) + request->length, GFP_KERNEL);
if (response == NULL)
return -ENOMEM;
@@ -403,9 +403,9 @@
complete_transaction, response);
if (request->data)
- return sizeof request + request->length;
+ return sizeof(request) + request->length;
else
- return sizeof request;
+ return sizeof(request);
}
struct address_handler {
@@ -450,8 +450,8 @@
struct request_event *e;
struct client *client = handler->client;
- request = kmalloc(sizeof *request, GFP_ATOMIC);
- e = kmalloc(sizeof *e, GFP_ATOMIC);
+ request = kmalloc(sizeof(*request), GFP_ATOMIC);
+ e = kmalloc(sizeof(*e), GFP_ATOMIC);
if (request == NULL || e == NULL) {
kfree(request);
kfree(e);
@@ -474,7 +474,7 @@
e->request.closure = handler->closure;
queue_event(client, &e->event,
- &e->request, sizeof e->request, payload, length);
+ &e->request, sizeof(e->request), payload, length);
}
static void
@@ -494,7 +494,7 @@
struct address_handler *handler;
struct fw_address_region region;
- handler = kmalloc(sizeof *handler, GFP_KERNEL);
+ handler = kmalloc(sizeof(*handler), GFP_KERNEL);
if (handler == NULL)
return -ENOMEM;
@@ -581,7 +581,7 @@
return -EINVAL;
descriptor =
- kmalloc(sizeof *descriptor + request->length * 4, GFP_KERNEL);
+ kmalloc(sizeof(*descriptor) + request->length * 4, GFP_KERNEL);
if (descriptor == NULL)
return -ENOMEM;
@@ -623,7 +623,7 @@
struct client *client = data;
struct iso_interrupt *interrupt;
- interrupt = kzalloc(sizeof *interrupt + header_length, GFP_ATOMIC);
+ interrupt = kzalloc(sizeof(*interrupt) + header_length, GFP_ATOMIC);
if (interrupt == NULL)
return;
@@ -634,7 +634,7 @@
memcpy(interrupt->interrupt.header, header, header_length);
queue_event(client, &interrupt->event,
&interrupt->interrupt,
- sizeof interrupt->interrupt + header_length, NULL, 0);
+ sizeof(interrupt->interrupt) + header_length, NULL, 0);
}
static int ioctl_create_iso_context(struct client *client, void *buffer)
@@ -717,7 +717,7 @@
end = (void __user *)p + request->size;
count = 0;
while (p < end) {
- if (__copy_from_user(&u.packet, p, sizeof *p))
+ if (__copy_from_user(&u.packet, p, sizeof(*p)))
return -EFAULT;
if (ctx->type == FW_ISO_CONTEXT_TRANSMIT) {
@@ -819,7 +819,7 @@
return -EINVAL;
if (_IOC_DIR(cmd) & _IOC_WRITE) {
- if (_IOC_SIZE(cmd) > sizeof buffer ||
+ if (_IOC_SIZE(cmd) > sizeof(buffer) ||
copy_from_user(buffer, arg, _IOC_SIZE(cmd)))
return -EFAULT;
}
@@ -829,7 +829,7 @@
return retval;
if (_IOC_DIR(cmd) & _IOC_READ) {
- if (_IOC_SIZE(cmd) > sizeof buffer ||
+ if (_IOC_SIZE(cmd) > sizeof(buffer) ||
copy_to_user(arg, buffer, _IOC_SIZE(cmd)))
return -EFAULT;
}
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c
index 8e5f17f..c1ce465 100644
--- a/drivers/firewire/fw-device.c
+++ b/drivers/firewire/fw-device.c
@@ -138,7 +138,7 @@
int length = 0;
int i = 0;
- get_modalias(unit, modalias, sizeof modalias);
+ get_modalias(unit, modalias, sizeof(modalias));
if (add_uevent_var(envp, num_envp, &i,
buffer, buffer_size, &length,
@@ -533,7 +533,7 @@
* Get the address of the unit directory and try to
* match the drivers id_tables against it.
*/
- unit = kzalloc(sizeof *unit, GFP_KERNEL);
+ unit = kzalloc(sizeof(*unit), GFP_KERNEL);
if (unit == NULL) {
fw_error("failed to allocate memory for unit\n");
continue;
@@ -543,7 +543,7 @@
unit->device.bus = &fw_bus_type;
unit->device.type = &fw_unit_type;
unit->device.parent = &device->device;
- snprintf(unit->device.bus_id, sizeof unit->device.bus_id,
+ snprintf(unit->device.bus_id, sizeof(unit->device.bus_id),
"%s.%d", device->device.bus_id, i++);
init_fw_attribute_group(&unit->device,
@@ -653,7 +653,7 @@
device->device.type = &fw_device_type;
device->device.parent = device->card->device;
device->device.devt = MKDEV(fw_cdev_major, minor);
- snprintf(device->device.bus_id, sizeof device->device.bus_id,
+ snprintf(device->device.bus_id, sizeof(device->device.bus_id),
"fw%d", minor);
init_fw_attribute_group(&device->device,
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 7d91b7e..5833ce1 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -255,7 +255,7 @@
return -ENOMEM;
}
- memset(&ab->descriptor, 0, sizeof ab->descriptor);
+ memset(&ab->descriptor, 0, sizeof(ab->descriptor));
ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE |
DESCRIPTOR_STATUS |
DESCRIPTOR_BRANCH_ALWAYS);
@@ -440,7 +440,7 @@
while (last->branch_address != 0) {
address = le32_to_cpu(last->branch_address);
z = address & 0xf;
- d = ctx->buffer + (address - ctx->buffer_bus) / sizeof *d;
+ d = ctx->buffer + (address - ctx->buffer_bus) / sizeof(*d);
last = (z == 2) ? d : d + z - 1;
if (!ctx->callback(ctx, d, last))
@@ -487,7 +487,7 @@
* element so that head == tail means buffer full.
*/
- memset(ctx->head_descriptor, 0, sizeof *ctx->head_descriptor);
+ memset(ctx->head_descriptor, 0, sizeof(*ctx->head_descriptor));
ctx->head_descriptor->control = cpu_to_le16(DESCRIPTOR_OUTPUT_LAST);
ctx->head_descriptor->transfer_status = cpu_to_le16(0x8011);
ctx->head_descriptor++;
@@ -512,7 +512,7 @@
d = ctx->head_descriptor;
tail = ctx->tail_descriptor;
- end = ctx->buffer + ctx->buffer_size / sizeof(struct descriptor);
+ end = ctx->buffer + ctx->buffer_size / sizeof(*d);
if (d + z <= tail) {
goto has_space;
@@ -526,8 +526,8 @@
return NULL;
has_space:
- memset(d, 0, z * sizeof *d);
- *d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof *d;
+ memset(d, 0, z * sizeof(*d));
+ *d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof(*d);
return d;
}
@@ -548,7 +548,7 @@
{
dma_addr_t d_bus;
- d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof *d;
+ d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof(*d);
ctx->head_descriptor = d + z + extra;
ctx->prev_descriptor->branch_address = cpu_to_le32(d_bus | z);
@@ -820,7 +820,7 @@
fw_notify("swap not done yet\n");
fw_fill_response(&response, packet->header,
- RCODE_COMPLETE, &lock_old, sizeof lock_old);
+ RCODE_COMPLETE, &lock_old, sizeof(lock_old));
out:
fw_core_handle_response(&ohci->card, &response);
}
@@ -1376,7 +1376,7 @@
regs = OHCI1394_IsoRcvContextBase(index);
ctx = &list[index];
- memset(ctx, 0, sizeof *ctx);
+ memset(ctx, 0, sizeof(*ctx));
ctx->header_length = 0;
ctx->header = (void *) __get_free_page(GFP_KERNEL);
if (ctx->header == NULL)
@@ -1518,7 +1518,7 @@
z += payload_z;
/* Get header size in number of descriptors. */
- header_z = DIV_ROUND_UP(p->header_length, sizeof *d);
+ header_z = DIV_ROUND_UP(p->header_length, sizeof(*d));
d = context_get_descriptors(&ctx->context, z + header_z, &d_bus);
if (d == NULL)
@@ -1541,7 +1541,7 @@
if (p->header_length > 0) {
d[2].req_count = cpu_to_le16(p->header_length);
- d[2].data_address = cpu_to_le32(d_bus + z * sizeof *d);
+ d[2].data_address = cpu_to_le32(d_bus + z * sizeof(*d));
memcpy(&d[z], p->header, p->header_length);
}
@@ -1620,7 +1620,7 @@
header_size = packet_count * (ctx->base.header_size + 4);
/* Get header size in number of descriptors. */
- header_z = DIV_ROUND_UP(header_size, sizeof *d);
+ header_z = DIV_ROUND_UP(header_size, sizeof(*d));
page = payload >> PAGE_SHIFT;
offset = payload & ~PAGE_MASK;
rest = p->payload_length;
@@ -1639,7 +1639,7 @@
db->first_size = cpu_to_le16(ctx->base.header_size + 4);
db->first_req_count = cpu_to_le16(header_size);
db->first_res_count = db->first_req_count;
- db->first_buffer = cpu_to_le32(d_bus + sizeof *db);
+ db->first_buffer = cpu_to_le32(d_bus + sizeof(*db));
if (offset + rest < PAGE_SIZE)
length = rest;
@@ -1755,7 +1755,7 @@
int error_code;
size_t size;
- ohci = kzalloc(sizeof *ohci, GFP_KERNEL);
+ ohci = kzalloc(sizeof(*ohci), GFP_KERNEL);
if (ohci == NULL) {
fw_error("Could not malloc fw_ohci data.\n");
return -ENOMEM;
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index e2ffbc8..6830041 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -279,7 +279,7 @@
unsigned long flags;
if (tcode != TCODE_WRITE_BLOCK_REQUEST ||
- length == 0 || length > sizeof status) {
+ length == 0 || length > sizeof(status)) {
fw_send_response(card, request, RCODE_TYPE_ERROR);
return;
}
@@ -340,7 +340,7 @@
orb->pointer.high = 0;
orb->pointer.low = orb->request_bus;
- fw_memcpy_to_be32(&orb->pointer, &orb->pointer, sizeof orb->pointer);
+ fw_memcpy_to_be32(&orb->pointer, &orb->pointer, sizeof(orb->pointer));
spin_lock_irqsave(&device->card->lock, flags);
list_add_tail(&orb->link, &sd->orb_list);
@@ -349,7 +349,7 @@
fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST,
node_id, generation,
device->node->max_speed, offset,
- &orb->pointer, sizeof orb->pointer,
+ &orb->pointer, sizeof(orb->pointer),
complete_transaction, orb);
}
@@ -386,7 +386,7 @@
(struct sbp2_management_orb *)base_orb;
if (status)
- memcpy(&orb->status, status, sizeof *status);
+ memcpy(&orb->status, status, sizeof(*status));
complete(&orb->done);
}
@@ -399,7 +399,7 @@
struct sbp2_management_orb *orb;
int retval = -ENOMEM;
- orb = kzalloc(sizeof *orb, GFP_ATOMIC);
+ orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
if (orb == NULL)
return -ENOMEM;
@@ -409,13 +409,13 @@
*/
orb->base.request_bus =
dma_map_single(device->card->device, &orb->request,
- sizeof orb->request, DMA_TO_DEVICE);
+ sizeof(orb->request), DMA_TO_DEVICE);
if (dma_mapping_error(orb->base.request_bus))
goto out;
orb->response_bus =
dma_map_single(device->card->device, &orb->response,
- sizeof orb->response, DMA_FROM_DEVICE);
+ sizeof(orb->response), DMA_FROM_DEVICE);
if (dma_mapping_error(orb->response_bus))
goto out;
@@ -427,7 +427,7 @@
MANAGEMENT_ORB_FUNCTION(function) |
MANAGEMENT_ORB_LUN(lun);
orb->request.length =
- MANAGEMENT_ORB_RESPONSE_LENGTH(sizeof orb->response);
+ MANAGEMENT_ORB_RESPONSE_LENGTH(sizeof(orb->response));
orb->request.status_fifo.high = sd->address_handler.offset >> 32;
orb->request.status_fifo.low = sd->address_handler.offset;
@@ -443,7 +443,7 @@
MANAGEMENT_ORB_RECONNECT(0);
}
- fw_memcpy_to_be32(&orb->request, &orb->request, sizeof orb->request);
+ fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request));
init_completion(&orb->done);
orb->base.callback = complete_management_orb;
@@ -478,13 +478,13 @@
retval = 0;
out:
dma_unmap_single(device->card->device, orb->base.request_bus,
- sizeof orb->request, DMA_TO_DEVICE);
+ sizeof(orb->request), DMA_TO_DEVICE);
dma_unmap_single(device->card->device, orb->response_bus,
- sizeof orb->response, DMA_FROM_DEVICE);
+ sizeof(orb->response), DMA_FROM_DEVICE);
if (response)
fw_memcpy_from_be32(response,
- orb->response, sizeof orb->response);
+ orb->response, sizeof(orb->response));
kfree(orb);
return retval;
@@ -506,14 +506,14 @@
struct fw_transaction *t;
static u32 zero;
- t = kzalloc(sizeof *t, GFP_ATOMIC);
+ t = kzalloc(sizeof(*t), GFP_ATOMIC);
if (t == NULL)
return -ENOMEM;
fw_send_request(device->card, t, TCODE_WRITE_QUADLET_REQUEST,
sd->node_id, sd->generation, SCODE_400,
sd->command_block_agent_address + SBP2_AGENT_RESET,
- &zero, sizeof zero, complete_agent_reset_write, t);
+ &zero, sizeof(zero), complete_agent_reset_write, t);
return 0;
}
@@ -870,7 +870,7 @@
}
dma_unmap_single(device->card->device, orb->base.request_bus,
- sizeof orb->request, DMA_TO_DEVICE);
+ sizeof(orb->request), DMA_TO_DEVICE);
if (orb->cmd->use_sg > 0) {
sg = (struct scatterlist *)orb->cmd->request_buffer;
@@ -880,11 +880,11 @@
if (orb->page_table_bus != 0)
dma_unmap_single(device->card->device, orb->page_table_bus,
- sizeof orb->page_table_bus, DMA_TO_DEVICE);
+ sizeof(orb->page_table_bus), DMA_TO_DEVICE);
if (orb->request_buffer_bus != 0)
dma_unmap_single(device->card->device, orb->request_buffer_bus,
- sizeof orb->request_buffer_bus,
+ sizeof(orb->request_buffer_bus),
DMA_FROM_DEVICE);
orb->cmd->result = result;
@@ -944,7 +944,7 @@
}
}
- size = sizeof orb->page_table[0] * j;
+ size = sizeof(orb->page_table[0]) * j;
/*
* The data_descriptor pointer is the one case where we need
@@ -997,7 +997,7 @@
return 0;
}
- orb = kzalloc(sizeof *orb, GFP_ATOMIC);
+ orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
if (orb == NULL) {
fw_notify("failed to alloc orb\n");
goto fail_alloc;
@@ -1007,7 +1007,7 @@
orb->base.rcode = -1;
orb->base.request_bus =
dma_map_single(device->card->device, &orb->request,
- sizeof orb->request, DMA_TO_DEVICE);
+ sizeof(orb->request), DMA_TO_DEVICE);
if (dma_mapping_error(orb->base.request_bus))
goto fail_mapping;
@@ -1038,10 +1038,10 @@
if (cmd->use_sg && sbp2_command_orb_map_scatterlist(orb) < 0)
goto fail_map_payload;
- fw_memcpy_to_be32(&orb->request, &orb->request, sizeof orb->request);
+ fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request));
memset(orb->request.command_block,
- 0, sizeof orb->request.command_block);
+ 0, sizeof(orb->request.command_block));
memcpy(orb->request.command_block, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd));
orb->base.callback = complete_command_orb;
@@ -1053,7 +1053,7 @@
fail_map_payload:
dma_unmap_single(device->card->device, orb->base.request_bus,
- sizeof orb->request, DMA_TO_DEVICE);
+ sizeof(orb->request), DMA_TO_DEVICE);
fail_mapping:
kfree(orb);
fail_alloc:
diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c
index b9dce70..7aebb8a 100644
--- a/drivers/firewire/fw-topology.c
+++ b/drivers/firewire/fw-topology.c
@@ -97,7 +97,7 @@
{
struct fw_node *node;
- node = kzalloc(sizeof *node + port_count * sizeof node->ports[0],
+ node = kzalloc(sizeof(*node) + port_count * sizeof(node->ports[0]),
GFP_ATOMIC);
if (node == NULL)
return NULL;
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index 01c438f..80d0121 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -305,7 +305,7 @@
{
struct fw_packet *packet;
- packet = kzalloc(sizeof *packet, GFP_ATOMIC);
+ packet = kzalloc(sizeof(*packet), GFP_ATOMIC);
if (packet == NULL)
return;
@@ -572,7 +572,7 @@
return NULL;
}
- request = kmalloc(sizeof *request + length, GFP_ATOMIC);
+ request = kmalloc(sizeof(*request) + length, GFP_ATOMIC);
if (request == NULL)
return NULL;
@@ -592,7 +592,7 @@
if (data)
memcpy(request->data, data, length);
- memcpy(request->request_header, p->header, sizeof p->header);
+ memcpy(request->request_header, p->header, sizeof(p->header));
return request;
}