Skip to content

Commit f209059

Browse files
yoshfujiStefan Richter
authored andcommitted
firewire net: Omit checking dev->broadcast_rcv_context in fwnet_broadcast_start().
dev->broadcast_rcv_context is always non-NULL if dev->broadcast_state is not FWNET_BROADCAST_ERROR. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
1 parent f60bac4 commit f209059

1 file changed

Lines changed: 26 additions & 31 deletions

File tree

‎drivers/firewire/net.c‎

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,7 @@ static int fwnet_broadcast_start(struct fwnet_device *dev)
11541154
unsigned max_receive;
11551155
struct fw_iso_packet packet;
11561156
unsigned long offset;
1157+
void **ptrptr;
11571158
unsigned u;
11581159

11591160
if (dev->broadcast_state != FWNET_BROADCAST_ERROR)
@@ -1162,42 +1163,36 @@ static int fwnet_broadcast_start(struct fwnet_device *dev)
11621163
max_receive = 1U << (dev->card->max_receive + 1);
11631164
num_packets = (FWNET_ISO_PAGE_COUNT * PAGE_SIZE) / max_receive;
11641165

1165-
if (!dev->broadcast_rcv_context) {
1166-
void **ptrptr;
1167-
1168-
context = fw_iso_context_create(dev->card,
1169-
FW_ISO_CONTEXT_RECEIVE, IEEE1394_BROADCAST_CHANNEL,
1170-
dev->card->link_speed, 8, fwnet_receive_broadcast, dev);
1171-
if (IS_ERR(context)) {
1172-
retval = PTR_ERR(context);
1173-
goto failed_context_create;
1174-
}
1166+
context = fw_iso_context_create(dev->card, FW_ISO_CONTEXT_RECEIVE,
1167+
IEEE1394_BROADCAST_CHANNEL,
1168+
dev->card->link_speed, 8,
1169+
fwnet_receive_broadcast, dev);
1170+
if (IS_ERR(context)) {
1171+
retval = PTR_ERR(context);
1172+
goto failed_context_create;
1173+
}
11751174

1176-
retval = fw_iso_buffer_init(&dev->broadcast_rcv_buffer,
1177-
dev->card, FWNET_ISO_PAGE_COUNT, DMA_FROM_DEVICE);
1178-
if (retval < 0)
1179-
goto failed_buffer_init;
1175+
retval = fw_iso_buffer_init(&dev->broadcast_rcv_buffer, dev->card,
1176+
FWNET_ISO_PAGE_COUNT, DMA_FROM_DEVICE);
1177+
if (retval < 0)
1178+
goto failed_buffer_init;
11801179

1181-
ptrptr = kmalloc(sizeof(void *) * num_packets, GFP_KERNEL);
1182-
if (!ptrptr) {
1183-
retval = -ENOMEM;
1184-
goto failed_ptrs_alloc;
1185-
}
1180+
ptrptr = kmalloc(sizeof(void *) * num_packets, GFP_KERNEL);
1181+
if (!ptrptr) {
1182+
retval = -ENOMEM;
1183+
goto failed_ptrs_alloc;
1184+
}
11861185

1187-
dev->broadcast_rcv_buffer_ptrs = ptrptr;
1188-
for (u = 0; u < FWNET_ISO_PAGE_COUNT; u++) {
1189-
void *ptr;
1190-
unsigned v;
1186+
dev->broadcast_rcv_buffer_ptrs = ptrptr;
1187+
for (u = 0; u < FWNET_ISO_PAGE_COUNT; u++) {
1188+
void *ptr;
1189+
unsigned v;
11911190

1192-
ptr = kmap(dev->broadcast_rcv_buffer.pages[u]);
1193-
for (v = 0; v < num_packets / FWNET_ISO_PAGE_COUNT; v++)
1194-
*ptrptr++ = (void *)
1195-
((char *)ptr + v * max_receive);
1196-
}
1197-
dev->broadcast_rcv_context = context;
1198-
} else {
1199-
context = dev->broadcast_rcv_context;
1191+
ptr = kmap(dev->broadcast_rcv_buffer.pages[u]);
1192+
for (v = 0; v < num_packets / FWNET_ISO_PAGE_COUNT; v++)
1193+
*ptrptr++ = (void *) ((char *)ptr + v * max_receive);
12001194
}
1195+
dev->broadcast_rcv_context = context;
12011196

12021197
packet.payload_length = max_receive;
12031198
packet.interrupt = 1;

0 commit comments

Comments
 (0)