mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH master 1/2] of: partition: skip NVMEM partition setup partition parsing fails
Date: Tue, 14 Mar 2023 10:02:26 +0100	[thread overview]
Message-ID: <20230314090226.GG7446@pengutronix.de> (raw)
In-Reply-To: <20230314085805.1860986-1-a.fatoum@pengutronix.de>

On Tue, Mar 14, 2023 at 09:58:04AM +0100, Ahmad Fatoum wrote:
> nvmem_partition_register should not be called with a NULL pointer
> argument, yet this is what happened when a partition with a nvmem-cells
> compatible conflicts with a partition parsed from an on-disk partition
> table. Fix this.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/of/partition.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/of/partition.c b/drivers/of/partition.c
> index ed1114193062..40c47f554ad2 100644
> --- a/drivers/of/partition.c
> +++ b/drivers/of/partition.c
> @@ -70,10 +70,10 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node)
>  	if (IS_ERR(new)) {
>  		pr_err("Adding partition %s failed: %pe\n", filename, new);
>  		new = NULL;
> +		goto out;
>  	}
>  
> -	if (new)
> -		new->device_node = node;
> +	new->device_node = node;
>  
>  	if (IS_ENABLED(CONFIG_NVMEM) && of_device_is_compatible(node, "nvmem-cells")) {
>  		struct nvmem_device *nvmem = nvmem_partition_register(new);
> @@ -81,6 +81,7 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node)
>  			dev_warn(cdev->dev, "nvmem registeration failed: %pe\n", nvmem);
>  	}
>  
> +out:
>  	free(filename);
>  
>  	return new;
> -- 
> 2.30.2
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




      parent reply	other threads:[~2023-03-14 13:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14  8:58 Ahmad Fatoum
2023-03-14  8:58 ` [PATCH master 2/2] commands: stat: fix UUID print Ahmad Fatoum
2023-03-14  9:02 ` Sascha Hauer [this message]

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=20230314090226.GG7446@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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