This function returns NULL on failure so lets do that if kzalloc()
fails.  There is a separate problem that the caller for this function
doesn't check for errors...

Signed-off-by: Dan Carpenter <[email protected]>

diff --git a/drivers/media/video/pvrusb2/pvrusb2-std.c 
b/drivers/media/video/pvrusb2/pvrusb2-std.c
index 370a9ab..b214f77 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-std.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-std.c
@@ -388,6 +388,9 @@ struct v4l2_standard *pvr2_std_create_enum(unsigned int 
*countptr,
 
        stddefs = kzalloc(sizeof(struct v4l2_standard) * std_cnt,
                          GFP_KERNEL);
+       if (!stddefs)
+               return NULL;
+
        for (idx = 0; idx < std_cnt; idx++)
                stddefs[idx].index = idx;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to