]> rtime.felk.cvut.cz Git - socketcan-devel.git/commitdiff
reordered some code in bcm_send_to_user().
authorhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Mon, 9 Jul 2007 06:10:18 +0000 (06:10 +0000)
committerhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Mon, 9 Jul 2007 06:10:18 +0000 (06:10 +0000)
git-svn-id: svn://svn.berlios.de//socketcan/trunk@418 030b6a49-0b11-0410-94ab-b0dab22257f2

kernel/2.6/net/can/bcm.c

index 4bc05e33f7d586d905562b4a74255863ab686632..6e6f0b4eb9e63023bec4f86c177fccf17230542d 100644 (file)
@@ -385,13 +385,26 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head,
 
        memcpy(skb_put(skb, sizeof(*head)), head, sizeof(*head));
 
-       /* can_frames starting here */
+       if (head->nframes) {
+               /* can_frames starting here */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
-       firstframe = (struct can_frame *) skb_tail_pointer(skb);
+               firstframe = (struct can_frame *) skb_tail_pointer(skb);
 #else
-       firstframe = (struct can_frame *) skb->tail;
+               firstframe = (struct can_frame *) skb->tail;
 #endif
 
+               memcpy(skb_put(skb, datalen), frames, datalen);
+
+               /*
+                * the BCM uses the can_dlc-element of the can_frame
+                * structure for internal purposes. This is only
+                * relevant for updates that are generated by the
+                * BCM, where nframes is 1
+                */
+               if (head->nframes == 1)
+                       firstframe->can_dlc &= BCM_CAN_DLC_MASK;
+       }
+
        if (has_timestamp) {
                /* restore rx timestamp */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
@@ -407,19 +420,6 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head,
        addr->can_family  = AF_CAN;
        addr->can_ifindex = op->rx_ifindex;
 
-       if (head->nframes) {
-               memcpy(skb_put(skb, datalen), frames, datalen);
-
-               /*
-                * the BCM uses the can_dlc-element of the can_frame
-                * structure for internal purposes. This is only
-                * relevant for updates that are generated by the
-                * BCM, where nframes is 1
-                */
-               if (head->nframes == 1)
-                       firstframe->can_dlc &= BCM_CAN_DLC_MASK;
-       }
-
        err = sock_queue_rcv_skb(sk, skb);
        if (err < 0) {
                struct bcm_sock *bo = bcm_sk(sk);