Remove fixed array size for can327_bitrate_const
[elmcan.git] / module / can327.c
index 7bb10e15e5606301fb086b46ab91034f567d0ba4..d522c08720563fb9c57b84829f83c9f79bf9386f 100644 (file)
 
 #include <linux/init.h>
 #include <linux/module.h>
-#include <linux/moduleparam.h>
 
-#include <linux/atomic.h>
 #include <linux/bitops.h>
 #include <linux/ctype.h>
-#include <linux/delay.h>
 #include <linux/errno.h>
-#include <linux/if_ether.h>
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/lockdep.h>
@@ -444,6 +440,7 @@ static int elm327_parse_frame(struct can327 *elm, size_t len)
                /* The line is likely garbled anyway, so bail.
                 * The main code will restart listening.
                 */
+               kfree_skb(skb);
                return -ENODATA;
        }
 
@@ -462,6 +459,7 @@ static int elm327_parse_frame(struct can327 *elm, size_t len)
                /* This is not a well-formatted data line.
                 * Assume it's an error message.
                 */
+               kfree_skb(skb);
                return -ENODATA;
        }
 
@@ -469,6 +467,7 @@ static int elm327_parse_frame(struct can327 *elm, size_t len)
                /* The line is too short to be a valid frame hex dump.
                 * Something interrupted the hex dump or it is invalid.
                 */
+               kfree_skb(skb);
                return -ENODATA;
        }
 
@@ -520,6 +519,7 @@ static int elm327_parse_frame(struct can327 *elm, size_t len)
                 * However, this will correctly drop the state machine back into
                 * command mode.
                 */
+               kfree_skb(skb);
                return -ENODATA;
        }
 
@@ -1052,7 +1052,7 @@ static void can327_ldisc_tx_wakeup(struct tty_struct *tty)
  * or 7/8 of that. Divisors are 1 to 64.
  * Currently we don't implement support for 7/8 rates.
  */
-static const u32 can327_bitrate_const[64] = {
+static const u32 can327_bitrate_const[] = {
         7812,  7936,  8064,  8196,  8333,  8474,  8620,  8771,
         8928,  9090,  9259,  9433,  9615,  9803, 10000, 10204,
        10416, 10638, 10869, 11111, 11363, 11627, 11904, 12195,