mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 21:33:00 +00:00
firewire: Always use parens with sizeof.
Signed-off-by: Kristian Hoegsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
This commit is contained in:
parent
213d7bbd76
commit
2d826cc5c7
@ -75,7 +75,7 @@ generate_config_rom(struct fw_card *card, size_t *config_rom_length)
|
||||
* 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_card_bm_work(struct work_struct *work)
|
||||
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);
|
||||
|
||||
|
@ -110,7 +110,7 @@ static int fw_device_op_open(struct inode *inode, struct file *file)
|
||||
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 @@ queue_bus_reset_event(struct client *client)
|
||||
{
|
||||
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 @@ queue_bus_reset_event(struct client *client)
|
||||
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 @@ static int ioctl_get_info(struct client *client, void *buffer)
|
||||
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 @@ complete_transaction(struct fw_card *card, int rcode,
|
||||
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 @@ static ssize_t ioctl_send_request(struct client *client, void *buffer)
|
||||
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 @@ static ssize_t ioctl_send_request(struct client *client, void *buffer)
|
||||
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 @@ handle_request(struct fw_card *card, struct fw_request *r,
|
||||
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 @@ handle_request(struct fw_card *card, struct fw_request *r,
|
||||
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 @@ static int ioctl_allocate(struct client *client, void *buffer)
|
||||
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 @@ static int ioctl_add_descriptor(struct client *client, void *buffer)
|
||||
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 @@ iso_callback(struct fw_iso_context *context, u32 cycle,
|
||||
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 @@ iso_callback(struct fw_iso_context *context, u32 cycle,
|
||||
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 @@ static int ioctl_queue_iso(struct client *client, void *buffer)
|
||||
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 @@ dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg)
|
||||
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 @@ dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg)
|
||||
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;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ fw_unit_uevent(struct device *dev, char **envp, int num_envp,
|
||||
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 @@ static void create_units(struct fw_device *device)
|
||||
* 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 @@ static void create_units(struct fw_device *device)
|
||||
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 @@ static void fw_device_init(struct work_struct *work)
|
||||
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,
|
||||
|
@ -255,7 +255,7 @@ static int ar_context_add_page(struct ar_context *ctx)
|
||||
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 @@ static void context_tasklet(unsigned long data)
|
||||
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 @@ context_init(struct context *ctx, struct fw_ohci *ohci,
|
||||
* 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 @@ context_get_descriptors(struct context *ctx, int z, dma_addr_t *d_bus)
|
||||
|
||||
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 @@ context_get_descriptors(struct context *ctx, int z, dma_addr_t *d_bus)
|
||||
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 @@ static void context_append(struct context *ctx,
|
||||
{
|
||||
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 @@ handle_local_lock(struct fw_ohci *ohci, struct fw_packet *packet, u32 csr)
|
||||
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 @@ ohci_allocate_iso_context(struct fw_card *card, int type, size_t header_size)
|
||||
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 @@ ohci_queue_iso_transmit(struct fw_iso_context *base,
|
||||
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 @@ ohci_queue_iso_transmit(struct fw_iso_context *base,
|
||||
|
||||
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 @@ ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base,
|
||||
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 @@ ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base,
|
||||
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 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
|
||||
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;
|
||||
|
@ -279,7 +279,7 @@ sbp2_status_write(struct fw_card *card, struct fw_request *request,
|
||||
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 @@ sbp2_send_orb(struct sbp2_orb *orb, struct fw_unit *unit,
|
||||
|
||||
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 @@ sbp2_send_orb(struct sbp2_orb *orb, struct fw_unit *unit,
|
||||
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 @@ complete_management_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
|
||||
(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 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
|
||||
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 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
|
||||
*/
|
||||
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 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
|
||||
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 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
|
||||
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 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
|
||||
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 @@ static int sbp2_agent_reset(struct fw_unit *unit)
|
||||
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 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
|
||||
}
|
||||
|
||||
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 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
|
||||
|
||||
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 @@ static int sbp2_command_orb_map_scatterlist(struct sbp2_command_orb *orb)
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
|
||||
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 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
|
||||
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 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
|
||||
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 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
|
||||
|
||||
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:
|
||||
|
@ -97,7 +97,7 @@ static struct fw_node *fw_node_create(u32 sid, int port_count, int color)
|
||||
{
|
||||
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;
|
||||
|
@ -305,7 +305,7 @@ static void send_phy_packet(struct fw_card *card, u32 data, int generation)
|
||||
{
|
||||
struct fw_packet *packet;
|
||||
|
||||
packet = kzalloc(sizeof *packet, GFP_ATOMIC);
|
||||
packet = kzalloc(sizeof(*packet), GFP_ATOMIC);
|
||||
if (packet == NULL)
|
||||
return;
|
||||
|
||||
@ -572,7 +572,7 @@ allocate_request(struct fw_packet *p)
|
||||
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 @@ allocate_request(struct fw_packet *p)
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user