2022-08-25 06:12:52

by Adrian Zaharia

[permalink] [raw]
Subject: [PATCH 1/1] mtd: mtdpart: Fix cosmetic print

From: Jani Nurminen <[email protected]>

The print of the MTD partitions during boot are off-by-one for the size.
Fix this and show the real last offset.

Fixes: 3d6f657ced2b ("mtd: mtdpart: Fix cosmetic print")
Signed-off-by: Jani Nurminen <[email protected]>
Signed-off-by: Adrian Zaharia <[email protected]>
---
drivers/mtd/mtdpart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index d442fa94c872..fab10e6d4171 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -118,7 +118,7 @@ static struct mtd_info *allocate_partition(struct mtd_info *parent,
child->part.size = parent_size - child->part.offset;

printk(KERN_NOTICE "0x%012llx-0x%012llx : \"%s\"\n",
- child->part.offset, child->part.offset + child->part.size,
+ child->part.offset, child->part.offset + child->part.size - 1,
child->name);

/* let's do some sanity checks */
--
2.37.2


2022-09-13 08:40:33

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 1/1] mtd: mtdpart: Fix cosmetic print

On 25.08.2022 08:04, Adrian Zaharia wrote:
> From: Jani Nurminen <[email protected]>
>
> The print of the MTD partitions during boot are off-by-one for the size.
> Fix this and show the real last offset.

I see that PCI subsystem and printk() + %pR do that. Probably more. I
guess it makes sense but I'm also wondering if/how confusing is that
change going to be for users. We did printing like that for probably
dozens of years.


> Fixes: 3d6f657ced2b ("mtd: mtdpart: Fix cosmetic print")

I can't find that hash / commit anywhere. Are you sure it exists?


> Signed-off-by: Jani Nurminen <[email protected]>
> Signed-off-by: Adrian Zaharia <[email protected]>
> ---
> drivers/mtd/mtdpart.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index d442fa94c872..fab10e6d4171 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -118,7 +118,7 @@ static struct mtd_info *allocate_partition(struct mtd_info *parent,
> child->part.size = parent_size - child->part.offset;
>
> printk(KERN_NOTICE "0x%012llx-0x%012llx : \"%s\"\n",
> - child->part.offset, child->part.offset + child->part.size,
> + child->part.offset, child->part.offset + child->part.size - 1,
> child->name);
>
> /* let's do some sanity checks */

2022-09-19 16:11:25

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH 1/1] mtd: mtdpart: Fix cosmetic print

Hello,

[email protected] wrote on Tue, 13 Sep 2022 09:37:21 +0200:

> On 25.08.2022 08:04, Adrian Zaharia wrote:
> > From: Jani Nurminen <[email protected]>
> >
> > The print of the MTD partitions during boot are off-by-one for the size.
> > Fix this and show the real last offset.
>
> I see that PCI subsystem and printk() + %pR do that. Probably more. I
> guess it makes sense but I'm also wondering if/how confusing is that
> change going to be for users. We did printing like that for probably
> dozens of years.

Agreed, I would rather not mess with this output which might be
considered part of the ABI, I am sure there are plenty of scripts out
there which do silly things with those lines :-)

>
>
> > Fixes: 3d6f657ced2b ("mtd: mtdpart: Fix cosmetic print")
>
> I can't find that hash / commit anywhere. Are you sure it exists?
>
>
> > Signed-off-by: Jani Nurminen <[email protected]>
> > Signed-off-by: Adrian Zaharia <[email protected]>
> > ---
> > drivers/mtd/mtdpart.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> > index d442fa94c872..fab10e6d4171 100644
> > --- a/drivers/mtd/mtdpart.c
> > +++ b/drivers/mtd/mtdpart.c
> > @@ -118,7 +118,7 @@ static struct mtd_info *allocate_partition(struct mtd_info *parent,
> > child->part.size = parent_size - child->part.offset;
> > > printk(KERN_NOTICE "0x%012llx-0x%012llx : \"%s\"\n",
> > - child->part.offset, child->part.offset + child->part.size,
> > + child->part.offset, child->part.offset + child->part.size - 1,
> > child->name);
> > > /* let's do some sanity checks */
>


Thanks,
Miquèl