All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH u-boot-marvell] arm: mvebu: turris_omnia: fix leaked mtd device
@ 2021-09-25  0:49 Marek Behún
  2021-09-25 16:05 ` Pali Rohár
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Marek Behún @ 2021-09-25  0:49 UTC (permalink / raw)
  To: Stefan Roese; +Cc: u-boot, pali, Marek Behún

From: Marek Behún <marek.behun@nic.cz>

After getting MTD device via get_mtd_device_nm(), we need to put it with
put_mtd_device(), otherwise we get

  Removing MTD device #0 (mx25l6405d) with use count 1

before booting kernel.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
---
 board/CZ.NIC/turris_omnia/turris_omnia.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index bac78af04e..a48e1f5c30 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -647,10 +647,13 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 	if (!fixup_mtd_partitions(blob, node, mtd))
 		goto fail;
 
+	put_mtd_device(mtd);
 	return 0;
 
 fail:
 	printf("Failed fixing SPI NOR partitions!\n");
+	if (!IS_ERR_OR_NULL(mtd))
+		put_mtd_device(mtd);
 	return 0;
 }
 #endif
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH u-boot-marvell] arm: mvebu: turris_omnia: fix leaked mtd device
  2021-09-25  0:49 [PATCH u-boot-marvell] arm: mvebu: turris_omnia: fix leaked mtd device Marek Behún
@ 2021-09-25 16:05 ` Pali Rohár
  2021-09-27  5:40   ` Stefan Roese
  2021-09-27  5:39 ` Stefan Roese
  2021-09-27  5:48 ` Stefan Roese
  2 siblings, 1 reply; 5+ messages in thread
From: Pali Rohár @ 2021-09-25 16:05 UTC (permalink / raw)
  To: Marek Behún, Stefan Roese; +Cc: u-boot, Marek Behún

On Saturday 25 September 2021 02:49:18 Marek Behún wrote:
> From: Marek Behún <marek.behun@nic.cz>
> 
> After getting MTD device via get_mtd_device_nm(), we need to put it with
> put_mtd_device(), otherwise we get
> 
>   Removing MTD device #0 (mx25l6405d) with use count 1
> 
> before booting kernel.
> 
> Signed-off-by: Marek Behún <marek.behun@nic.cz>

Reviewed-by: Pali Rohár <pali@kernel.org>
Tested-by: Pali Rohár <pali@kernel.org>
Fixes: 92f36c8e74c1 ("arm: mvebu: turris_omnia: fixup MTD partitions in Linux' DTB")

Above commit was introduced in v2021.10-rc1, so I think this fixup
should go into v2021.10.

Stefan, what do you think?

> ---
>  board/CZ.NIC/turris_omnia/turris_omnia.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
> index bac78af04e..a48e1f5c30 100644
> --- a/board/CZ.NIC/turris_omnia/turris_omnia.c
> +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
> @@ -647,10 +647,13 @@ int ft_board_setup(void *blob, struct bd_info *bd)
>  	if (!fixup_mtd_partitions(blob, node, mtd))
>  		goto fail;
>  
> +	put_mtd_device(mtd);
>  	return 0;
>  
>  fail:
>  	printf("Failed fixing SPI NOR partitions!\n");
> +	if (!IS_ERR_OR_NULL(mtd))
> +		put_mtd_device(mtd);
>  	return 0;
>  }
>  #endif
> -- 
> 2.32.0
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH u-boot-marvell] arm: mvebu: turris_omnia: fix leaked mtd device
  2021-09-25  0:49 [PATCH u-boot-marvell] arm: mvebu: turris_omnia: fix leaked mtd device Marek Behún
  2021-09-25 16:05 ` Pali Rohár
@ 2021-09-27  5:39 ` Stefan Roese
  2021-09-27  5:48 ` Stefan Roese
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Roese @ 2021-09-27  5:39 UTC (permalink / raw)
  To: Marek Behún; +Cc: u-boot, pali, Marek Behún

On 25.09.21 02:49, Marek Behún wrote:
> From: Marek Behún <marek.behun@nic.cz>
> 
> After getting MTD device via get_mtd_device_nm(), we need to put it with
> put_mtd_device(), otherwise we get
> 
>    Removing MTD device #0 (mx25l6405d) with use count 1
> 
> before booting kernel.
> 
> Signed-off-by: Marek Behún <marek.behun@nic.cz>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   board/CZ.NIC/turris_omnia/turris_omnia.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
> index bac78af04e..a48e1f5c30 100644
> --- a/board/CZ.NIC/turris_omnia/turris_omnia.c
> +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
> @@ -647,10 +647,13 @@ int ft_board_setup(void *blob, struct bd_info *bd)
>   	if (!fixup_mtd_partitions(blob, node, mtd))
>   		goto fail;
>   
> +	put_mtd_device(mtd);
>   	return 0;
>   
>   fail:
>   	printf("Failed fixing SPI NOR partitions!\n");
> +	if (!IS_ERR_OR_NULL(mtd))
> +		put_mtd_device(mtd);
>   	return 0;
>   }
>   #endif
> 


Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH u-boot-marvell] arm: mvebu: turris_omnia: fix leaked mtd device
  2021-09-25 16:05 ` Pali Rohár
@ 2021-09-27  5:40   ` Stefan Roese
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Roese @ 2021-09-27  5:40 UTC (permalink / raw)
  To: Pali Rohár, Marek Behún; +Cc: u-boot, Marek Behún

On 25.09.21 18:05, Pali Rohár wrote:
> On Saturday 25 September 2021 02:49:18 Marek Behún wrote:
>> From: Marek Behún <marek.behun@nic.cz>
>>
>> After getting MTD device via get_mtd_device_nm(), we need to put it with
>> put_mtd_device(), otherwise we get
>>
>>    Removing MTD device #0 (mx25l6405d) with use count 1
>>
>> before booting kernel.
>>
>> Signed-off-by: Marek Behún <marek.behun@nic.cz>
> 
> Reviewed-by: Pali Rohár <pali@kernel.org>
> Tested-by: Pali Rohár <pali@kernel.org>
> Fixes: 92f36c8e74c1 ("arm: mvebu: turris_omnia: fixup MTD partitions in Linux' DTB")
> 
> Above commit was introduced in v2021.10-rc1, so I think this fixup
> should go into v2021.10.
> 
> Stefan, what do you think?

Makes sense. I'll push this out today.

Thanks,
Stefan

>> ---
>>   board/CZ.NIC/turris_omnia/turris_omnia.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
>> index bac78af04e..a48e1f5c30 100644
>> --- a/board/CZ.NIC/turris_omnia/turris_omnia.c
>> +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
>> @@ -647,10 +647,13 @@ int ft_board_setup(void *blob, struct bd_info *bd)
>>   	if (!fixup_mtd_partitions(blob, node, mtd))
>>   		goto fail;
>>   
>> +	put_mtd_device(mtd);
>>   	return 0;
>>   
>>   fail:
>>   	printf("Failed fixing SPI NOR partitions!\n");
>> +	if (!IS_ERR_OR_NULL(mtd))
>> +		put_mtd_device(mtd);
>>   	return 0;
>>   }
>>   #endif
>> -- 
>> 2.32.0
>>


Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH u-boot-marvell] arm: mvebu: turris_omnia: fix leaked mtd device
  2021-09-25  0:49 [PATCH u-boot-marvell] arm: mvebu: turris_omnia: fix leaked mtd device Marek Behún
  2021-09-25 16:05 ` Pali Rohár
  2021-09-27  5:39 ` Stefan Roese
@ 2021-09-27  5:48 ` Stefan Roese
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Roese @ 2021-09-27  5:48 UTC (permalink / raw)
  To: Marek Behún; +Cc: u-boot, pali, Marek Behún

On 25.09.21 02:49, Marek Behún wrote:
> From: Marek Behún <marek.behun@nic.cz>
> 
> After getting MTD device via get_mtd_device_nm(), we need to put it with
> put_mtd_device(), otherwise we get
> 
>    Removing MTD device #0 (mx25l6405d) with use count 1
> 
> before booting kernel.
> 
> Signed-off-by: Marek Behún <marek.behun@nic.cz>

Applied to u-boot-marvell/master

Thanks,
Stefan

> ---
>   board/CZ.NIC/turris_omnia/turris_omnia.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
> index bac78af04e..a48e1f5c30 100644
> --- a/board/CZ.NIC/turris_omnia/turris_omnia.c
> +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
> @@ -647,10 +647,13 @@ int ft_board_setup(void *blob, struct bd_info *bd)
>   	if (!fixup_mtd_partitions(blob, node, mtd))
>   		goto fail;
>   
> +	put_mtd_device(mtd);
>   	return 0;
>   
>   fail:
>   	printf("Failed fixing SPI NOR partitions!\n");
> +	if (!IS_ERR_OR_NULL(mtd))
> +		put_mtd_device(mtd);
>   	return 0;
>   }
>   #endif
> 


Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-27  5:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-25  0:49 [PATCH u-boot-marvell] arm: mvebu: turris_omnia: fix leaked mtd device Marek Behún
2021-09-25 16:05 ` Pali Rohár
2021-09-27  5:40   ` Stefan Roese
2021-09-27  5:39 ` Stefan Roese
2021-09-27  5:48 ` Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.