lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 14 Jun 2024 11:31:43 +0100
From: Cristian Marussi <cristian.marussi@....com>
To: Sudeep Holla <sudeep.holla@....com>
Cc: "Peng Fan (OSS)" <peng.fan@....nxp.com>,
	Cristian Marussi <cristian.marussi@....com>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	linux-arm-kernel@...ts.infradead.org, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, Peng Fan <peng.fan@....com>
Subject: Re: [PATCH v2 2/2] firmware: arm_scmi: mailbox: support P2A channel
 completion

On Fri, Jun 14, 2024 at 10:19:42AM +0100, Sudeep Holla wrote:
> On Fri, May 10, 2024 at 11:19:48AM +0800, Peng Fan (OSS) wrote:
> 
> There was some coding style error reported(unbalanced {}) which made me
> look at the code again. I don't think we need to splat out error.
> 
> > @@ -300,8 +326,30 @@ static void mailbox_fetch_notification(struct scmi_chan_info *cinfo,
> >  static void mailbox_clear_channel(struct scmi_chan_info *cinfo)
> >  {
> >  	struct scmi_mailbox *smbox = cinfo->transport_info;
> > +	struct device *cdev = cinfo->dev;
> > +	struct mbox_chan *intr;
> > +	int ret;
> >  
> >  	shmem_clear_channel(smbox->shmem);
> > +
> > +	if (!shmem_channel_intr_enabled(smbox->shmem))
> > +		return;
> > +
> > +	if (smbox->chan_platform_receiver)
> > +		intr = smbox->chan_platform_receiver;
> > +	else if (smbox->chan)
> > +		intr = smbox->chan;
> > +	else {
> > +		dev_err(cdev, "Channel INTR wrongly set?\n");
> > +		return;
> > +	}
> > 
> 
> If it is OK I would like to fix it up with below change.
> 

Hi,

> Regards,
> Sudeep
> 
> -->8
> 
> diff --git i/drivers/firmware/arm_scmi/mailbox.c w/drivers/firmware/arm_scmi/mailbox.c
> index adb69a6a0223..3bb3fba8f478 100644
> --- i/drivers/firmware/arm_scmi/mailbox.c
> +++ w/drivers/firmware/arm_scmi/mailbox.c
> @@ -326,30 +326,25 @@ static void mailbox_fetch_notification(struct scmi_chan_info *cinfo,
>  static void mailbox_clear_channel(struct scmi_chan_info *cinfo)
>  {
>         struct scmi_mailbox *smbox = cinfo->transport_info;
> -       struct device *cdev = cinfo->dev;
> -       struct mbox_chan *intr;
> +       struct mbox_chan *intr_chan = NULL;
>         int ret;
> 
>         shmem_clear_channel(smbox->shmem);
> 
> -       if (!shmem_channel_intr_enabled(smbox->shmem))
> -               return;
> -
>         if (smbox->chan_platform_receiver)
> -               intr = smbox->chan_platform_receiver;
> +               intr_chan = smbox->chan_platform_receiver;
>         else if (smbox->chan)
> -               intr = smbox->chan;
> -       else {
> -               dev_err(cdev, "Channel INTR wrongly set?\n");
> +               intr_chan = smbox->chan;
> +
> +       if (!(intr_chan && shmem_channel_intr_enabled(smbox->shmem)))
>                 return;
> -       }

Fine with dropping the dev_err() but is not this cumulative negated-if a
bit cryptic...also you can bail out early straight away as before when
platform has not required any P2A completion irq...I mean something like

	
       struct mbox_chan *intr_chan = NULL;

       shmem_clear_channel(smbox->shmem);
       if (!shmem_channel_intr_enabled(smbox->shmem))
		return;

       if (smbox->chan_platform_receiver)
		intr_chan = smbox->chan_platform_receiver;
       else if (smbox->chan)
		intr_chan = smbox->chan;

       if (!intr_chan)
	       return;

(or just a dangling else return;)


.. no strongs opinion here really, though.

Thanks,
Cristian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ