Re: [PATCH] ieee1394: remove NULL checks prior to kfree in ieee1394, kfree handles null pointers fine.

2005-04-21 Thread Jody McIntyre
On Sat, Apr 16, 2005 at 05:55:19PM +0200, Jesper Juhl wrote:
> This patch removes redundant NULL pointer checks before kfree() in all of 
> drivers/ieee1394/

Thanks, applied to our SVN and queued for 2.6.13.

Jody

> 
> Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]>
> ---
> 
>  drivers/ieee1394/nodemgr.c   |3 +--
>  drivers/ieee1394/ohci1394.c  |2 +-
>  drivers/ieee1394/video1394.c |   29 -
>  3 files changed, 10 insertions(+), 24 deletions(-)
> 
> 
> diff -upr linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/nodemgr.c 
> linux-2.6.12-rc2-mm3/drivers/ieee1394/nodemgr.c
> --- linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/nodemgr.c  2005-04-11 
> 21:20:41.0 +0200
> +++ linux-2.6.12-rc2-mm3/drivers/ieee1394/nodemgr.c   2005-04-16 
> 17:44:23.0 +0200
> @@ -1006,8 +1006,7 @@ static struct unit_directory *nodemgr_pr
>   return ud;
>  
>  unit_directory_error:
> - if (ud != NULL)
> - kfree(ud);
> + kfree(ud);
>   return NULL;
>  }
>  
> diff -upr linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/ohci1394.c 
> linux-2.6.12-rc2-mm3/drivers/ieee1394/ohci1394.c
> --- linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/ohci1394.c 2005-04-05 
> 21:21:24.0 +0200
> +++ linux-2.6.12-rc2-mm3/drivers/ieee1394/ohci1394.c  2005-04-16 
> 17:44:48.0 +0200
> @@ -2893,7 +2893,7 @@ static void free_dma_rcv_ctx(struct dma_
>   kfree(d->prg_cpu);
>   kfree(d->prg_bus);
>   }
> - if (d->spb) kfree(d->spb);
> + kfree(d->spb);
>  
>   /* Mark this context as freed. */
>   d->ohci = NULL;
> diff -upr linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/video1394.c 
> linux-2.6.12-rc2-mm3/drivers/ieee1394/video1394.c
> --- linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/video1394.c2005-04-11 
> 21:20:41.0 +0200
> +++ linux-2.6.12-rc2-mm3/drivers/ieee1394/video1394.c 2005-04-16 
> 17:47:03.0 +0200
> @@ -180,23 +180,13 @@ static int free_dma_iso_ctx(struct dma_i
>   kfree(d->prg_reg);
>   }
>  
> - if (d->ir_prg)
> - kfree(d->ir_prg);
> -
> - if (d->it_prg)
> - kfree(d->it_prg);
> -
> - if (d->buffer_status)
> - kfree(d->buffer_status);
> - if (d->buffer_time)
> - kfree(d->buffer_time);
> - if (d->last_used_cmd)
> - kfree(d->last_used_cmd);
> - if (d->next_buffer)
> - kfree(d->next_buffer);
> -
> + kfree(d->ir_prg);
> + kfree(d->it_prg);
> + kfree(d->buffer_status);
> + kfree(d->buffer_time);
> + kfree(d->last_used_cmd);
> + kfree(d->next_buffer);
>   list_del(>link);
> -
>   kfree(d);
>  
>   return 0;
> @@ -1060,8 +1050,7 @@ static int __video1394_ioctl(struct file
>   PRINT(KERN_ERR, ohci->host->id,
> "Buffer %d is already used",v.buffer);
>   spin_unlock_irqrestore(>lock,flags);
> - if (psizes)
> - kfree(psizes);
> + kfree(psizes);
>   return -EBUSY;
>   }
>  
> @@ -1116,9 +1105,7 @@ static int __video1394_ioctl(struct file
>   }
>   }
>  
> - if (psizes)
> - kfree(psizes);
> -
> + kfree(psizes);
>   return 0;
>  
>   }
> 
> 
> 
> -- 
> Jesper Juhl
> 
> PS. Please CC: me on replies as I'm not subscribed to the linux1394-devel 
> list.
> 
> 
> 
> 
> ---
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595_id=14396=click
> ___
> mailing list [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/linux1394-devel

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


Re: [PATCH] ieee1394: remove NULL checks prior to kfree in ieee1394, kfree handles null pointers fine.

2005-04-21 Thread Jody McIntyre
On Sat, Apr 16, 2005 at 05:55:19PM +0200, Jesper Juhl wrote:
 This patch removes redundant NULL pointer checks before kfree() in all of 
 drivers/ieee1394/

Thanks, applied to our SVN and queued for 2.6.13.

Jody

 
 Signed-off-by: Jesper Juhl [EMAIL PROTECTED]
 ---
 
  drivers/ieee1394/nodemgr.c   |3 +--
  drivers/ieee1394/ohci1394.c  |2 +-
  drivers/ieee1394/video1394.c |   29 -
  3 files changed, 10 insertions(+), 24 deletions(-)
 
 
 diff -upr linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/nodemgr.c 
 linux-2.6.12-rc2-mm3/drivers/ieee1394/nodemgr.c
 --- linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/nodemgr.c  2005-04-11 
 21:20:41.0 +0200
 +++ linux-2.6.12-rc2-mm3/drivers/ieee1394/nodemgr.c   2005-04-16 
 17:44:23.0 +0200
 @@ -1006,8 +1006,7 @@ static struct unit_directory *nodemgr_pr
   return ud;
  
  unit_directory_error:
 - if (ud != NULL)
 - kfree(ud);
 + kfree(ud);
   return NULL;
  }
  
 diff -upr linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/ohci1394.c 
 linux-2.6.12-rc2-mm3/drivers/ieee1394/ohci1394.c
 --- linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/ohci1394.c 2005-04-05 
 21:21:24.0 +0200
 +++ linux-2.6.12-rc2-mm3/drivers/ieee1394/ohci1394.c  2005-04-16 
 17:44:48.0 +0200
 @@ -2893,7 +2893,7 @@ static void free_dma_rcv_ctx(struct dma_
   kfree(d-prg_cpu);
   kfree(d-prg_bus);
   }
 - if (d-spb) kfree(d-spb);
 + kfree(d-spb);
  
   /* Mark this context as freed. */
   d-ohci = NULL;
 diff -upr linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/video1394.c 
 linux-2.6.12-rc2-mm3/drivers/ieee1394/video1394.c
 --- linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/video1394.c2005-04-11 
 21:20:41.0 +0200
 +++ linux-2.6.12-rc2-mm3/drivers/ieee1394/video1394.c 2005-04-16 
 17:47:03.0 +0200
 @@ -180,23 +180,13 @@ static int free_dma_iso_ctx(struct dma_i
   kfree(d-prg_reg);
   }
  
 - if (d-ir_prg)
 - kfree(d-ir_prg);
 -
 - if (d-it_prg)
 - kfree(d-it_prg);
 -
 - if (d-buffer_status)
 - kfree(d-buffer_status);
 - if (d-buffer_time)
 - kfree(d-buffer_time);
 - if (d-last_used_cmd)
 - kfree(d-last_used_cmd);
 - if (d-next_buffer)
 - kfree(d-next_buffer);
 -
 + kfree(d-ir_prg);
 + kfree(d-it_prg);
 + kfree(d-buffer_status);
 + kfree(d-buffer_time);
 + kfree(d-last_used_cmd);
 + kfree(d-next_buffer);
   list_del(d-link);
 -
   kfree(d);
  
   return 0;
 @@ -1060,8 +1050,7 @@ static int __video1394_ioctl(struct file
   PRINT(KERN_ERR, ohci-host-id,
 Buffer %d is already used,v.buffer);
   spin_unlock_irqrestore(d-lock,flags);
 - if (psizes)
 - kfree(psizes);
 + kfree(psizes);
   return -EBUSY;
   }
  
 @@ -1116,9 +1105,7 @@ static int __video1394_ioctl(struct file
   }
   }
  
 - if (psizes)
 - kfree(psizes);
 -
 + kfree(psizes);
   return 0;
  
   }
 
 
 
 -- 
 Jesper Juhl
 
 PS. Please CC: me on replies as I'm not subscribed to the linux1394-devel 
 list.
 
 
 
 
 ---
 SF email is sponsored by - The IT Product Guide
 Read honest  candid reviews on hundreds of IT Products from real users.
 Discover which products truly live up to the hype. Start reading now.
 http://ads.osdn.com/?ad_id=6595alloc_id=14396op=click
 ___
 mailing list [EMAIL PROTECTED]
 https://lists.sourceforge.net/lists/listinfo/linux1394-devel

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


[PATCH] ieee1394: remove NULL checks prior to kfree in ieee1394, kfree handles null pointers fine.

2005-04-16 Thread Jesper Juhl
This patch removes redundant NULL pointer checks before kfree() in all of 
drivers/ieee1394/

Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]>
---

 drivers/ieee1394/nodemgr.c   |3 +--
 drivers/ieee1394/ohci1394.c  |2 +-
 drivers/ieee1394/video1394.c |   29 -
 3 files changed, 10 insertions(+), 24 deletions(-)


diff -upr linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/nodemgr.c 
linux-2.6.12-rc2-mm3/drivers/ieee1394/nodemgr.c
--- linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/nodemgr.c2005-04-11 
21:20:41.0 +0200
+++ linux-2.6.12-rc2-mm3/drivers/ieee1394/nodemgr.c 2005-04-16 
17:44:23.0 +0200
@@ -1006,8 +1006,7 @@ static struct unit_directory *nodemgr_pr
return ud;
 
 unit_directory_error:
-   if (ud != NULL)
-   kfree(ud);
+   kfree(ud);
return NULL;
 }
 
diff -upr linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/ohci1394.c 
linux-2.6.12-rc2-mm3/drivers/ieee1394/ohci1394.c
--- linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/ohci1394.c   2005-04-05 
21:21:24.0 +0200
+++ linux-2.6.12-rc2-mm3/drivers/ieee1394/ohci1394.c2005-04-16 
17:44:48.0 +0200
@@ -2893,7 +2893,7 @@ static void free_dma_rcv_ctx(struct dma_
kfree(d->prg_cpu);
kfree(d->prg_bus);
}
-   if (d->spb) kfree(d->spb);
+   kfree(d->spb);
 
/* Mark this context as freed. */
d->ohci = NULL;
diff -upr linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/video1394.c 
linux-2.6.12-rc2-mm3/drivers/ieee1394/video1394.c
--- linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/video1394.c  2005-04-11 
21:20:41.0 +0200
+++ linux-2.6.12-rc2-mm3/drivers/ieee1394/video1394.c   2005-04-16 
17:47:03.0 +0200
@@ -180,23 +180,13 @@ static int free_dma_iso_ctx(struct dma_i
kfree(d->prg_reg);
}
 
-   if (d->ir_prg)
-   kfree(d->ir_prg);
-
-   if (d->it_prg)
-   kfree(d->it_prg);
-
-   if (d->buffer_status)
-   kfree(d->buffer_status);
-   if (d->buffer_time)
-   kfree(d->buffer_time);
-   if (d->last_used_cmd)
-   kfree(d->last_used_cmd);
-   if (d->next_buffer)
-   kfree(d->next_buffer);
-
+   kfree(d->ir_prg);
+   kfree(d->it_prg);
+   kfree(d->buffer_status);
+   kfree(d->buffer_time);
+   kfree(d->last_used_cmd);
+   kfree(d->next_buffer);
list_del(>link);
-
kfree(d);
 
return 0;
@@ -1060,8 +1050,7 @@ static int __video1394_ioctl(struct file
PRINT(KERN_ERR, ohci->host->id,
  "Buffer %d is already used",v.buffer);
spin_unlock_irqrestore(>lock,flags);
-   if (psizes)
-   kfree(psizes);
+   kfree(psizes);
return -EBUSY;
}
 
@@ -1116,9 +1105,7 @@ static int __video1394_ioctl(struct file
}
}
 
-   if (psizes)
-   kfree(psizes);
-
+   kfree(psizes);
return 0;
 
}



-- 
Jesper Juhl

PS. Please CC: me on replies as I'm not subscribed to the linux1394-devel list.


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


[PATCH] ieee1394: remove NULL checks prior to kfree in ieee1394, kfree handles null pointers fine.

2005-04-16 Thread Jesper Juhl
This patch removes redundant NULL pointer checks before kfree() in all of 
drivers/ieee1394/

Signed-off-by: Jesper Juhl [EMAIL PROTECTED]
---

 drivers/ieee1394/nodemgr.c   |3 +--
 drivers/ieee1394/ohci1394.c  |2 +-
 drivers/ieee1394/video1394.c |   29 -
 3 files changed, 10 insertions(+), 24 deletions(-)


diff -upr linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/nodemgr.c 
linux-2.6.12-rc2-mm3/drivers/ieee1394/nodemgr.c
--- linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/nodemgr.c2005-04-11 
21:20:41.0 +0200
+++ linux-2.6.12-rc2-mm3/drivers/ieee1394/nodemgr.c 2005-04-16 
17:44:23.0 +0200
@@ -1006,8 +1006,7 @@ static struct unit_directory *nodemgr_pr
return ud;
 
 unit_directory_error:
-   if (ud != NULL)
-   kfree(ud);
+   kfree(ud);
return NULL;
 }
 
diff -upr linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/ohci1394.c 
linux-2.6.12-rc2-mm3/drivers/ieee1394/ohci1394.c
--- linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/ohci1394.c   2005-04-05 
21:21:24.0 +0200
+++ linux-2.6.12-rc2-mm3/drivers/ieee1394/ohci1394.c2005-04-16 
17:44:48.0 +0200
@@ -2893,7 +2893,7 @@ static void free_dma_rcv_ctx(struct dma_
kfree(d-prg_cpu);
kfree(d-prg_bus);
}
-   if (d-spb) kfree(d-spb);
+   kfree(d-spb);
 
/* Mark this context as freed. */
d-ohci = NULL;
diff -upr linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/video1394.c 
linux-2.6.12-rc2-mm3/drivers/ieee1394/video1394.c
--- linux-2.6.12-rc2-mm3-orig/drivers/ieee1394/video1394.c  2005-04-11 
21:20:41.0 +0200
+++ linux-2.6.12-rc2-mm3/drivers/ieee1394/video1394.c   2005-04-16 
17:47:03.0 +0200
@@ -180,23 +180,13 @@ static int free_dma_iso_ctx(struct dma_i
kfree(d-prg_reg);
}
 
-   if (d-ir_prg)
-   kfree(d-ir_prg);
-
-   if (d-it_prg)
-   kfree(d-it_prg);
-
-   if (d-buffer_status)
-   kfree(d-buffer_status);
-   if (d-buffer_time)
-   kfree(d-buffer_time);
-   if (d-last_used_cmd)
-   kfree(d-last_used_cmd);
-   if (d-next_buffer)
-   kfree(d-next_buffer);
-
+   kfree(d-ir_prg);
+   kfree(d-it_prg);
+   kfree(d-buffer_status);
+   kfree(d-buffer_time);
+   kfree(d-last_used_cmd);
+   kfree(d-next_buffer);
list_del(d-link);
-
kfree(d);
 
return 0;
@@ -1060,8 +1050,7 @@ static int __video1394_ioctl(struct file
PRINT(KERN_ERR, ohci-host-id,
  Buffer %d is already used,v.buffer);
spin_unlock_irqrestore(d-lock,flags);
-   if (psizes)
-   kfree(psizes);
+   kfree(psizes);
return -EBUSY;
}
 
@@ -1116,9 +1105,7 @@ static int __video1394_ioctl(struct file
}
}
 
-   if (psizes)
-   kfree(psizes);
-
+   kfree(psizes);
return 0;
 
}



-- 
Jesper Juhl

PS. Please CC: me on replies as I'm not subscribed to the linux1394-devel list.


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