Merge branch 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal...
[pandora-kernel.git] / drivers / media / video / pvrusb2 / pvrusb2-std.c
index ca9f83a..453627b 100644 (file)
@@ -278,12 +278,10 @@ static struct v4l2_standard generic_standards[] = {
        }
 };
 
-#define generic_standards_cnt ARRAY_SIZE(generic_standards)
-
 static struct v4l2_standard *match_std(v4l2_std_id id)
 {
        unsigned int idx;
-       for (idx = 0; idx < generic_standards_cnt; idx++) {
+       for (idx = 0; idx < ARRAY_SIZE(generic_standards); idx++) {
                if (generic_standards[idx].id & id) {
                        return generic_standards + idx;
                }
@@ -370,7 +368,11 @@ struct v4l2_standard *pvr2_std_create_enum(unsigned int *countptr,
 
        stddefs = kzalloc(sizeof(struct v4l2_standard) * std_cnt,
                          GFP_KERNEL);
-       for (idx = 0; idx < std_cnt; idx++) stddefs[idx].index = idx;
+       if (!stddefs)
+               return NULL;
+
+       for (idx = 0; idx < std_cnt; idx++)
+               stddefs[idx].index = idx;
 
        idx = 0;