On Mon, Jan 24, 2022 at 06:26:45PM +0300, Pavel Skripkin wrote: > Hi Stefan, > > On 1/23/22 23:02, Stefan Wahren wrote: > > Better use kzalloc to properly init vchiq_service with zero. As a result > > this saves us all the zero assignments. > > > > Signed-off-by: Stefan Wahren <stefan.wahren@xxxxxxxx> > > --- > > .../vc04_services/interface/vchiq_arm/vchiq_core.c | 23 +--------------------- > > 1 file changed, 1 insertion(+), 22 deletions(-) > > > > diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c > > index 6fa9fee..a13a076 100644 > > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c > > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c > > @@ -2097,16 +2097,6 @@ sync_func(void *v) > > return 0; > > } > > -static void > > -init_bulk_queue(struct vchiq_bulk_queue *queue) > > -{ > > - queue->local_insert = 0; > > - queue->remote_insert = 0; > > - queue->process = 0; > > - queue->remote_notify = 0; > > - queue->remove = 0; > > -} > > - > > inline const char * > > get_conn_state_name(enum vchiq_connstate conn_state) > > { > > @@ -2371,7 +2361,7 @@ vchiq_add_service_internal(struct vchiq_state *state, > > if (ret) > > return NULL; > > - service = kmalloc(sizeof(*service), GFP_KERNEL); > > + service = kzalloc(sizeof(*service), GFP_KERNEL); > > if (!service) > > return service; > > @@ -2387,28 +2377,17 @@ vchiq_add_service_internal(struct vchiq_state *state, > > service->public_fourcc = (srvstate == VCHIQ_SRVSTATE_OPENING) ? > > VCHIQ_FOURCC_INVALID : params->fourcc; > > - service->client_id = 0; > > service->auto_close = 1; > > - service->sync = 0; > > - service->closing = 0; > > - service->trace = 0; > > atomic_set(&service->poll_flags, 0); > > Nit: atomic_set(0) can be also removed > No, let's not write code that assumes it knows atomic_t internals. regards, dan carpenter