diff mbox series

[v1,2/5] firmware: microchip: don't unconditionally print validation success

Message ID 20240410-throwing-sandworm-7d03e4e2f4e8@spud (mailing list archive)
State Accepted
Delegated to: Conor Dooley
Headers show
Series PolarFire SoC Auto Update design info support | expand

Checks

Context Check Description
conchuod/vmtest-fixes-PR fail merge-conflict

Commit Message

Conor Dooley April 10, 2024, 11:58 a.m. UTC
From: Conor Dooley <conor.dooley@microchip.com>

If validation fails, both prints are made. Skip the success one in the
failure case.

Fixes: ec5b0f1193ad ("firmware: microchip: add PolarFire SoC Auto Update support")
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
 drivers/firmware/microchip/mpfs-auto-update.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Alexandre Ghiti April 24, 2024, 8:26 p.m. UTC | #1
Hi Conor,

On 10/04/2024 13:58, Conor Dooley wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
>
> If validation fails, both prints are made. Skip the success one in the
> failure case.
>
> Fixes: ec5b0f1193ad ("firmware: microchip: add PolarFire SoC Auto Update support")
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> ---
>   drivers/firmware/microchip/mpfs-auto-update.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/firmware/microchip/mpfs-auto-update.c b/drivers/firmware/microchip/mpfs-auto-update.c
> index 33343e83373c..298ad21e139b 100644
> --- a/drivers/firmware/microchip/mpfs-auto-update.c
> +++ b/drivers/firmware/microchip/mpfs-auto-update.c
> @@ -218,10 +218,12 @@ static int mpfs_auto_update_verify_image(struct fw_upload *fw_uploader)
>   	if (ret | response->resp_status) {
>   		dev_warn(priv->dev, "Verification of Upgrade Image failed!\n");
>   		ret = ret ? ret : -EBADMSG;
> +		goto free_message;
>   	}
>   
>   	dev_info(priv->dev, "Verification of Upgrade Image passed!\n");
>   
> +free_message:
>   	devm_kfree(priv->dev, message);
>   free_response:
>   	devm_kfree(priv->dev, response);


This should go into -fixes, but not sure if you take care of this or if 
Palmer should, please let me know so that I can remove this from my list :)

Thanks,

Alex
Conor Dooley April 24, 2024, 8:59 p.m. UTC | #2
On Wed, Apr 24, 2024 at 10:26:35PM +0200, Alexandre Ghiti wrote:
> Hi Conor,
> 
> On 10/04/2024 13:58, Conor Dooley wrote:
> > From: Conor Dooley <conor.dooley@microchip.com>
> > 
> > If validation fails, both prints are made. Skip the success one in the
> > failure case.
> > 
> > Fixes: ec5b0f1193ad ("firmware: microchip: add PolarFire SoC Auto Update support")
> > Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> > ---
> >   drivers/firmware/microchip/mpfs-auto-update.c | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/firmware/microchip/mpfs-auto-update.c b/drivers/firmware/microchip/mpfs-auto-update.c
> > index 33343e83373c..298ad21e139b 100644
> > --- a/drivers/firmware/microchip/mpfs-auto-update.c
> > +++ b/drivers/firmware/microchip/mpfs-auto-update.c
> > @@ -218,10 +218,12 @@ static int mpfs_auto_update_verify_image(struct fw_upload *fw_uploader)
> >   	if (ret | response->resp_status) {
> >   		dev_warn(priv->dev, "Verification of Upgrade Image failed!\n");
> >   		ret = ret ? ret : -EBADMSG;
> > +		goto free_message;
> >   	}
> >   	dev_info(priv->dev, "Verification of Upgrade Image passed!\n");
> > +free_message:
> >   	devm_kfree(priv->dev, message);
> >   free_response:
> >   	devm_kfree(priv->dev, response);
> 
> 
> This should go into -fixes, but not sure if you take care of this or if
> Palmer should, please let me know so that I can remove this from my list :)


Yea, probably this and "firmware: microchip: clarify that sizes and
addresses are in hex" should go on fixes. FYI, I usually set the
delegate on patchwork for things that I take to me, so generally you
should be able to tell from that.

Cheers,
Conor.
Conor Dooley April 24, 2024, 9:04 p.m. UTC | #3
On Wed, Apr 24, 2024 at 09:59:36PM +0100, Conor Dooley wrote:
> On Wed, Apr 24, 2024 at 10:26:35PM +0200, Alexandre Ghiti wrote:
> > Hi Conor,
> > 
> > On 10/04/2024 13:58, Conor Dooley wrote:
> > > From: Conor Dooley <conor.dooley@microchip.com>
> > > 
> > > If validation fails, both prints are made. Skip the success one in the
> > > failure case.
> > > 
> > > Fixes: ec5b0f1193ad ("firmware: microchip: add PolarFire SoC Auto Update support")
> > > Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> > > ---
> > >   drivers/firmware/microchip/mpfs-auto-update.c | 2 ++
> > >   1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/drivers/firmware/microchip/mpfs-auto-update.c b/drivers/firmware/microchip/mpfs-auto-update.c
> > > index 33343e83373c..298ad21e139b 100644
> > > --- a/drivers/firmware/microchip/mpfs-auto-update.c
> > > +++ b/drivers/firmware/microchip/mpfs-auto-update.c
> > > @@ -218,10 +218,12 @@ static int mpfs_auto_update_verify_image(struct fw_upload *fw_uploader)
> > >   	if (ret | response->resp_status) {
> > >   		dev_warn(priv->dev, "Verification of Upgrade Image failed!\n");
> > >   		ret = ret ? ret : -EBADMSG;
> > > +		goto free_message;
> > >   	}
> > >   	dev_info(priv->dev, "Verification of Upgrade Image passed!\n");
> > > +free_message:
> > >   	devm_kfree(priv->dev, message);
> > >   free_response:
> > >   	devm_kfree(priv->dev, response);
> > 
> > 
> > This should go into -fixes, but not sure if you take care of this or if
> > Palmer should, please let me know so that I can remove this from my list :)
> 
> 
> Yea, probably this and "firmware: microchip: clarify that sizes and
> addresses are in hex" should go on fixes. FYI, I usually set the
> delegate on patchwork for things that I take to me, so generally you
> should be able to tell from that.

I picked up 2 and 3. I'll send a PR with them later in the week, thanks
for the reminder. Patches like these I kinda dislike applying without a
review, but don't really get reviewed unless I harass someone at work to
do so, which I did not do here.

Cheers,
Conor.
diff mbox series

Patch

diff --git a/drivers/firmware/microchip/mpfs-auto-update.c b/drivers/firmware/microchip/mpfs-auto-update.c
index 33343e83373c..298ad21e139b 100644
--- a/drivers/firmware/microchip/mpfs-auto-update.c
+++ b/drivers/firmware/microchip/mpfs-auto-update.c
@@ -218,10 +218,12 @@  static int mpfs_auto_update_verify_image(struct fw_upload *fw_uploader)
 	if (ret | response->resp_status) {
 		dev_warn(priv->dev, "Verification of Upgrade Image failed!\n");
 		ret = ret ? ret : -EBADMSG;
+		goto free_message;
 	}
 
 	dev_info(priv->dev, "Verification of Upgrade Image passed!\n");
 
+free_message:
 	devm_kfree(priv->dev, message);
 free_response:
 	devm_kfree(priv->dev, response);