summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAmit Choudhary <amit2030@gmail.com>2007-05-08 09:26:13 +0200
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 20:15:02 +0200
commitd9a2f4a4945ebff54c9a011e4dc6e92d899ae26d (patch)
treef2a6b0ef82232251701363f1f3da2d51d6f09c0f /drivers
parentremove unused header file: drivers/char/digi.h (diff)
downloadlinux-d9a2f4a4945ebff54c9a011e4dc6e92d899ae26d.tar.xz
linux-d9a2f4a4945ebff54c9a011e4dc6e92d899ae26d.zip
drivers/char/synclink.c: check kmalloc() return value
Signed-off-by: Amit Choudhary <amit2030@gmail.com> Cc: Paul Fulghum <paulkf@microgate.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/synclink.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index ce4db6f52362..f02a0795983f 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -4010,8 +4010,13 @@ static int mgsl_alloc_intermediate_txbuffer_memory(struct mgsl_struct *info)
for ( i=0; i<info->num_tx_holding_buffers; ++i) {
info->tx_holding_buffers[i].buffer =
kmalloc(info->max_frame_size, GFP_KERNEL);
- if ( info->tx_holding_buffers[i].buffer == NULL )
+ if (info->tx_holding_buffers[i].buffer == NULL) {
+ for (--i; i >= 0; i--) {
+ kfree(info->tx_holding_buffers[i].buffer);
+ info->tx_holding_buffers[i].buffer = NULL;
+ }
return -ENOMEM;
+ }
}
return 0;