mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Peter Holik" <peter@holik.at>
To: "Oliver Neukum" <oliver@neukum.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb driver for intellon based PLC like devolo dlan duo
Date: Sat, 18 Apr 2009 09:16:28 +0200 (CEST)	[thread overview]
Message-ID: <8472e581ef388a89b5ee8a7ed8dd1fdc.squirrel@webmail.it-technology.at> (raw)
In-Reply-To: <200904171641.33546.oliver@neukum.org>

> Am Freitag 17 April 2009 16:10:24 schrieb Peter Holik:
>
> +static int intellon_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
> +{
> +       int len;
> +
> +       if (unlikely(skb->len < INTELLON_HEADER_SIZE)) {
> +               deverr(dev, "unexpected tiny rx frame");
> +               return 0;
> +       }
> +
> +       len = (skb->data[skb->len - 2] | (skb->data[skb->len - 1] << 8));
>
> Please use a conversion function.

do you mean

len = le16_to_cpu(skb->data[skb->len - 2] | (skb->data[skb->len - 1] << 8));

> +       } else {
> +               struct sk_buff *skb2;
> +
> +               skb2 = skb_copy_expand(skb,
> +                               INTELLON_HEADER_SIZE,
> +                               need_tail,
> +                               flags);
> +               dev_kfree_skb_any(skb);
> +               if (!skb2)
> +                       return skb2;
>
> If you return NULL in an error case, write it so explicitely.

ok

> +       __skb_push(skb, INTELLON_HEADER_SIZE);
> +
> +       skb->data[0] = pack_len & 0xFF;
> +       skb->data[1] = (pack_len & 0x700) >> 8;
>
> Again, a conversion function is called for.

is this correct

  __le16 *len;
.
.
.
  pack_len &= 0x07ff;

  len = (__le16 *) __skb_push(skb, INT51X1_HEADER_SIZE);
  *len = cpu_to_le16(pack_len);


cu Peter


  reply	other threads:[~2009-04-18  7:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-17 14:10 Peter Holik
2009-04-17 14:32 ` Florian Fainelli
2009-04-17 19:07   ` Guennadi Liakhovetski
2009-04-18  8:55     ` David Miller
2009-04-18 19:54       ` Guennadi Liakhovetski
2009-04-19  4:15         ` David Miller
2009-04-19  4:24           ` David Miller
2009-04-19  8:32           ` Guennadi Liakhovetski
2009-04-19  8:35             ` David Miller
2009-04-18  6:48   ` Peter Holik
2009-04-18 10:22     ` Florian Fainelli
2009-04-18 13:42       ` Jon Smirl
2009-04-17 14:41 ` Oliver Neukum
2009-04-18  7:16   ` Peter Holik [this message]
2009-04-18  7:38     ` Oliver Neukum
2009-04-18  8:41       ` Peter Holik
2009-04-18  8:49         ` Oliver Neukum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8472e581ef388a89b5ee8a7ed8dd1fdc.squirrel@webmail.it-technology.at \
    --to=peter@holik.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oliver@neukum.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®