@@ -189,13 +189,12 @@ static int agp_create_segment(struct agp_client *client, struct agp_region *regi
189189 struct agp_segment * user_seg ;
190190 size_t i ;
191191
192- seg = kmalloc ((sizeof (struct agp_segment_priv ) * region -> seg_count ), GFP_KERNEL );
192+ seg = kzalloc ((sizeof (struct agp_segment_priv ) * region -> seg_count ), GFP_KERNEL );
193193 if (seg == NULL ) {
194194 kfree (region -> seg_list );
195195 region -> seg_list = NULL ;
196196 return - ENOMEM ;
197197 }
198- memset (seg , 0 , (sizeof (struct agp_segment_priv ) * region -> seg_count ));
199198 user_seg = region -> seg_list ;
200199
201200 for (i = 0 ; i < region -> seg_count ; i ++ ) {
@@ -332,14 +331,11 @@ static struct agp_controller *agp_create_controller(pid_t id)
332331{
333332 struct agp_controller * controller ;
334333
335- controller = kmalloc (sizeof (struct agp_controller ), GFP_KERNEL );
336-
334+ controller = kzalloc (sizeof (struct agp_controller ), GFP_KERNEL );
337335 if (controller == NULL )
338336 return NULL ;
339337
340- memset (controller , 0 , sizeof (struct agp_controller ));
341338 controller -> pid = id ;
342-
343339 return controller ;
344340}
345341
@@ -540,12 +536,10 @@ static struct agp_client *agp_create_client(pid_t id)
540536{
541537 struct agp_client * new_client ;
542538
543- new_client = kmalloc (sizeof (struct agp_client ), GFP_KERNEL );
544-
539+ new_client = kzalloc (sizeof (struct agp_client ), GFP_KERNEL );
545540 if (new_client == NULL )
546541 return NULL ;
547542
548- memset (new_client , 0 , sizeof (struct agp_client ));
549543 new_client -> pid = id ;
550544 agp_insert_client (new_client );
551545 return new_client ;
@@ -709,11 +703,10 @@ static int agp_open(struct inode *inode, struct file *file)
709703 if (minor != AGPGART_MINOR )
710704 goto err_out ;
711705
712- priv = kmalloc (sizeof (struct agp_file_private ), GFP_KERNEL );
706+ priv = kzalloc (sizeof (struct agp_file_private ), GFP_KERNEL );
713707 if (priv == NULL )
714708 goto err_out_nomem ;
715709
716- memset (priv , 0 , sizeof (struct agp_file_private ));
717710 set_bit (AGP_FF_ALLOW_CLIENT , & priv -> access_flags );
718711 priv -> my_pid = current -> pid ;
719712
0 commit comments