From a592a3323dbdbc4958cece20f6285ffee1b1a46c Mon Sep 17 00:00:00 2001 From: Xiaochen Wang Date: Sun, 13 Mar 2011 22:32:53 -0300 Subject: [PATCH] --- yaml --- r: 242078 b: refs/heads/master c: c05df8b32ab4b8103f8c20cbd3ab7191be613b68 h: refs/heads/master v: v3 --- [refs] | 2 +- .../drivers/media/video/pvrusb2/pvrusb2-hdw.c | 24 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index f7783b2d4fa9..ae1abb05ae15 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 228ee5928b5d4192a23cda3fdf755a956516c13e +refs/heads/master: c05df8b32ab4b8103f8c20cbd3ab7191be613b68 diff --git a/trunk/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/trunk/drivers/media/video/pvrusb2/pvrusb2-hdw.c index d33dd61de263..9d0dd08f57f8 100644 --- a/trunk/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/trunk/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -2850,15 +2850,23 @@ static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw) PVR2_TRACE_ERROR_LEGS, "WARNING: Failed to identify any viable standards"); } + + /* Set up the dynamic control for this standard */ hdw->std_enum_names = kmalloc(sizeof(char *)*(std_cnt+1),GFP_KERNEL); - hdw->std_enum_names[0] = "none"; - for (idx = 0; idx < std_cnt; idx++) { - hdw->std_enum_names[idx+1] = - newstd[idx].name; - } - // Set up the dynamic control for this standard - hdw->std_info_enum.def.type_enum.value_names = hdw->std_enum_names; - hdw->std_info_enum.def.type_enum.count = std_cnt+1; + if (hdw->std_enum_names) { + hdw->std_enum_names[0] = "none"; + for (idx = 0; idx < std_cnt; idx++) + hdw->std_enum_names[idx+1] = newstd[idx].name; + hdw->std_info_enum.def.type_enum.value_names = + hdw->std_enum_names; + hdw->std_info_enum.def.type_enum.count = std_cnt+1; + } else { + pvr2_trace( + PVR2_TRACE_ERROR_LEGS, + "WARNING: Failed to alloc memory for names"); + hdw->std_info_enum.def.type_enum.value_names = NULL; + hdw->std_info_enum.def.type_enum.count = 0; + } hdw->std_defs = newstd; hdw->std_enum_cnt = std_cnt+1; hdw->std_enum_cur = 0;