lkml.org 
[lkml]   [2007]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 2.6.20] ibm_emac: Use ARRAY_SIZE macro when appropriate
On Mon, Feb 05, 2007 at 06:59:16PM +0200, Ahmed S. Darwish wrote:
> A patch to use ARRAY_SIZE macro already defined in kernel.h.

OK, but checks you're changing are strange. idx there is signed so

BUG_ON(idx < 0 || idx > ARRAY_SIZE());

should be more appropriate.

> --- a/drivers/net/ibm_emac/ibm_emac_debug.c
> +++ b/drivers/net/ibm_emac/ibm_emac_debug.c
> @@ -132,7 +132,7 @@ void emac_dbg_register(int idx, struct ocp_enet_private *dev)
> {
> unsigned long flags;
>
> - if (idx >= sizeof(__emacs) / sizeof(__emacs[0])) {
> + if (idx >= ARRAY_SIZE(__emacs)) {

no __vi, no cookie. :)

> printk(KERN_WARNING
> "invalid index %d when registering EMAC for debugging\n",
> idx);
> @@ -148,7 +148,7 @@ void mal_dbg_register(int idx, struct ibm_ocp_mal *mal)
> {
> unsigned long flags;
>
> - if (idx >= sizeof(__mals) / sizeof(__mals[0])) {
> + if (idx >= ARRAY_SIZE(__mals)) {
> printk(KERN_WARNING
> "invalid index %d when registering MAL for debugging\n",
> idx);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-02-05 21:25    [W:0.086 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site