Linux kernel staging patches
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Pavel Skripkin <paskripkin@gmail.com>
Cc: Stefan Wahren <stefan.wahren@i2se.com>,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	bcm-kernel-feedback-list@broadcom.com,
	Phil Elwell <phil@raspberrypi.com>,
	Gaston Gonzalez <gascoar@gmail.com>,
	linux-staging@lists.linux.dev
Subject: Re: [PATCH 08/18] staging: vchiq_core: simplify vchiq_add_service_internal
Date: Tue, 25 Jan 2022 12:59:40 +0300	[thread overview]
Message-ID: <20220125095940.GT1951@kadam> (raw)
In-Reply-To: <74c587ca-4ce9-68e6-8eb1-f956ca05cef3@gmail.com>

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@i2se.com>
> > ---
> >   .../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


  reply	other threads:[~2022-01-25 10:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23 20:02 [PATCH 00/18] staging: vchiq_arm: minor adjustments Stefan Wahren
2022-01-23 20:02 ` [PATCH 01/18] staging: vchiq_core: fix indentation in vchiq_log_dump_mem Stefan Wahren
2022-01-23 20:02 ` [PATCH 02/18] staging: vchiq_debugfs: get the rid of n_log_entries Stefan Wahren
2022-01-23 20:02 ` [PATCH 03/18] staging: vchiq_arm: introduce is_adjacent_block Stefan Wahren
2022-01-23 20:02 ` [PATCH 04/18] staging: vchiq: convert TODOs into unordered list Stefan Wahren
2022-01-23 20:02 ` [PATCH 05/18] staging: vchiq: drop completed tasks from TODO Stefan Wahren
2022-01-23 20:02 ` [PATCH 06/18] staging: vchiq: add message handling to TODO list Stefan Wahren
2022-01-23 20:02 ` [PATCH 07/18] staging: vchiq_core: fix type of parameter localport Stefan Wahren
2022-01-23 20:02 ` [PATCH 08/18] staging: vchiq_core: simplify vchiq_add_service_internal Stefan Wahren
2022-01-24 15:26   ` Pavel Skripkin
2022-01-25  9:59     ` Dan Carpenter [this message]
2022-01-25 10:06       ` Pavel Skripkin
2022-01-25 10:20         ` Dan Carpenter
2022-01-25 10:22           ` Pavel Skripkin
2022-01-23 20:02 ` [PATCH 09/18] staging: vchiq_core: align return statements in msg_type_str Stefan Wahren
2022-01-23 20:02 ` [PATCH 10/18] staging: vchiq_core: drop prefix of vchiq_set_service_state Stefan Wahren
2022-01-23 20:02 ` [PATCH 11/18] staging: vchiq_core: reduce multi-line statements Stefan Wahren
2022-01-23 20:02 ` [PATCH 12/18] staging: vchiq_core: fix alignment Stefan Wahren
2022-01-23 20:02 ` [PATCH 13/18] staging: vchiq_core: avoid ternary operator for set_service_state Stefan Wahren
2022-01-23 20:02 ` [PATCH 14/18] staging: vchiq_core: use min_t macro Stefan Wahren
2022-01-23 20:02 ` [PATCH 15/18] staging: vchiq_arm: make vchiq_get_state return early Stefan Wahren
2022-01-23 20:02 ` [PATCH 16/18] staging: vchiq_arm: Avoid NULL ptr deref in vchiq_dump_platform_instances Stefan Wahren
2022-01-23 20:02 ` [PATCH 17/18] staging: vchiq_core: handle NULL result of find_service_by_handle Stefan Wahren
2022-01-23 20:02 ` [PATCH 18/18] staging: vchiq_dev: Avoid unnecessary alloc in vchiq_ioc_create_service Stefan Wahren
2022-01-24  9:52 ` [PATCH 00/18] staging: vchiq_arm: minor adjustments nicolas saenz julienne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220125095940.GT1951@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=gascoar@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=nsaenz@kernel.org \
    --cc=paskripkin@gmail.com \
    --cc=phil@raspberrypi.com \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox