Skip to content

Commit

Permalink
IXP4xx: Ensure index is positive in irq_to_gpio() and npe_request().
Browse files Browse the repository at this point in the history
The indexes were signed, so negatives were possible.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
  • Loading branch information
Roel Kluin authored and Krzysztof Hałasa committed Dec 5, 2009
1 parent 9f2c949 commit efec194
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion arch/arm/mach-ixp4xx/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ int gpio_to_irq(int gpio)
}
EXPORT_SYMBOL(gpio_to_irq);

int irq_to_gpio(int irq)
int irq_to_gpio(unsigned int irq)
{
int gpio = (irq < 32) ? irq2gpio[irq] : -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-ixp4xx/include/mach/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
#include <asm-generic/gpio.h> /* cansleep wrappers */

extern int gpio_to_irq(int gpio);
extern int irq_to_gpio(int gpio);
extern int irq_to_gpio(unsigned int irq);

#endif

2 changes: 1 addition & 1 deletion arch/arm/mach-ixp4xx/include/mach/npe.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int npe_send_message(struct npe *npe, const void *msg, const char *what);
int npe_recv_message(struct npe *npe, void *msg, const char *what);
int npe_send_recv_message(struct npe *npe, void *msg, const char *what);
int npe_load_firmware(struct npe *npe, const char *name, struct device *dev);
struct npe *npe_request(int id);
struct npe *npe_request(unsigned id);
void npe_release(struct npe *npe);

#endif /* __IXP4XX_NPE_H */
2 changes: 1 addition & 1 deletion arch/arm/mach-ixp4xx/ixp4xx_npe.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ int npe_load_firmware(struct npe *npe, const char *name, struct device *dev)
}


struct npe *npe_request(int id)
struct npe *npe_request(unsigned id)
{
if (id < NPE_COUNT)
if (npe_tab[id].valid)
Expand Down

0 comments on commit efec194

Please sign in to comment.