mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 23:24:50 +00:00
arcnet: Make a char * array const char * const
Might as well be specific about the use of this array. Add a commment questioning the indexing too. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
This commit is contained in:
parent
26c6d28168
commit
4e299b922c
1 changed files with 10 additions and 5 deletions
|
@ -42,10 +42,10 @@
|
||||||
#include "arcdevice.h"
|
#include "arcdevice.h"
|
||||||
#include "com20020.h"
|
#include "com20020.h"
|
||||||
|
|
||||||
static char *clockrates[] = {
|
static const char * const clockrates[] = {
|
||||||
"XXXXXXX", "XXXXXXXX", "XXXXXX",
|
"XXXXXXX", "XXXXXXXX", "XXXXXX", "2.5 Mb/s",
|
||||||
"2.5 Mb/s", "1.25Mb/s", "625 Kb/s", "312.5 Kb/s",
|
"1.25Mb/s", "625 Kb/s", "312.5 Kb/s", "156.25 Kb/s",
|
||||||
"156.25 Kb/s", "Reserved", "Reserved", "Reserved"
|
"Reserved", "Reserved", "Reserved"
|
||||||
};
|
};
|
||||||
|
|
||||||
static void com20020_command(struct net_device *dev, int command);
|
static void com20020_command(struct net_device *dev, int command);
|
||||||
|
@ -234,7 +234,12 @@ int com20020_found(struct net_device *dev, int shared)
|
||||||
|
|
||||||
arc_printk(D_NORMAL, dev, "Using CKP %d - data rate %s\n",
|
arc_printk(D_NORMAL, dev, "Using CKP %d - data rate %s\n",
|
||||||
lp->setup >> 1,
|
lp->setup >> 1,
|
||||||
clockrates[3 - ((lp->setup2 & 0xF0) >> 4) + ((lp->setup & 0x0F) >> 1)]);
|
clockrates[3 -
|
||||||
|
((lp->setup2 & 0xF0) >> 4) +
|
||||||
|
((lp->setup & 0x0F) >> 1)]);
|
||||||
|
/* The clockrates array index looks very fragile.
|
||||||
|
* It seems like it could have negative indexing.
|
||||||
|
*/
|
||||||
|
|
||||||
if (register_netdev(dev)) {
|
if (register_netdev(dev)) {
|
||||||
free_irq(dev->irq, dev);
|
free_irq(dev->irq, dev);
|
||||||
|
|
Loading…
Reference in a new issue