* [PATCH 1/2] of: base: Fix phandle argument length mismatch error message
@ 2021-12-21 8:50 Baruch Siach
2021-12-21 8:50 ` [PATCH 2/2] of: base: Improve argument length mismatch error Baruch Siach
2021-12-21 14:50 ` kernel test robot
0 siblings, 2 replies; 6+ messages in thread
From: Baruch Siach @ 2021-12-21 8:50 UTC (permalink / raw)
To: Rob Herring, Frank Rowand; +Cc: devicetree, Baruch Siach, Florian Fainelli
The cell_count field of of_phandle_iterator is the number of cells we
expect in the phandle arguments list when cells_name is missing. The
error message should show the number of cells we actually see.
Fixes: af3be70a321 ("of: Improve of_phandle_iterator_next() error message")
Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
drivers/of/base.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 61de453b885c..64218c614a85 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1349,9 +1349,9 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it)
* property data length
*/
if (it->cur + count > it->list_end) {
- pr_err("%pOF: %s = %d found %d\n",
+ pr_err("%pOF: %s = %d found %ld\n",
it->parent, it->cells_name,
- count, it->cell_count);
+ count, it->list_end - it->cur);
goto err;
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] of: base: Improve argument length mismatch error
2021-12-21 8:50 [PATCH 1/2] of: base: Fix phandle argument length mismatch error message Baruch Siach
@ 2021-12-21 8:50 ` Baruch Siach
2021-12-21 11:24 ` Rob Herring
2021-12-21 14:50 ` kernel test robot
1 sibling, 1 reply; 6+ messages in thread
From: Baruch Siach @ 2021-12-21 8:50 UTC (permalink / raw)
To: Rob Herring, Frank Rowand; +Cc: devicetree, Baruch Siach
The cells_name field of of_phandle_iterator might be NULL. Use the
phandle name instead. With this change we get the more helpful messages:
OF: /soc/pinctrl@1000000: phandle pinctrl@1000000 needs 3, found 2
instead of:
OF: /soc/pinctrl@1000000: (null) = 3 found 2
That should make DT debugging easier.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
drivers/of/base.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 64218c614a85..7c03de370913 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1349,9 +1349,14 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it)
* property data length
*/
if (it->cur + count > it->list_end) {
- pr_err("%pOF: %s = %d found %ld\n",
- it->parent, it->cells_name,
- count, it->list_end - it->cur);
+ if (it->cells_name)
+ pr_err("%pOF: %s = %d found %ld\n",
+ it->parent, it->cells_name,
+ count, it->list_end - it->cur);
+ else
+ pr_err("%pOF: phandle %s needs %d, found %ld\n",
+ it->parent, of_node_full_name(it->node),
+ count, it->list_end - it->cur);
goto err;
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] of: base: Improve argument length mismatch error
2021-12-21 8:50 ` [PATCH 2/2] of: base: Improve argument length mismatch error Baruch Siach
@ 2021-12-21 11:24 ` Rob Herring
2021-12-21 16:38 ` Baruch Siach
0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2021-12-21 11:24 UTC (permalink / raw)
To: Baruch Siach; +Cc: Frank Rowand, devicetree
On Tue, Dec 21, 2021 at 4:51 AM Baruch Siach <baruch@tkos.co.il> wrote:
>
> The cells_name field of of_phandle_iterator might be NULL. Use the
> phandle name instead. With this change we get the more helpful messages:
>
> OF: /soc/pinctrl@1000000: phandle pinctrl@1000000 needs 3, found 2
How is printing the same thing twice better?
>
> instead of:
>
> OF: /soc/pinctrl@1000000: (null) = 3 found 2
>
> That should make DT debugging easier.
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
> drivers/of/base.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 64218c614a85..7c03de370913 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1349,9 +1349,14 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it)
> * property data length
> */
> if (it->cur + count > it->list_end) {
> - pr_err("%pOF: %s = %d found %ld\n",
> - it->parent, it->cells_name,
> - count, it->list_end - it->cur);
> + if (it->cells_name)
> + pr_err("%pOF: %s = %d found %ld\n",
> + it->parent, it->cells_name,
> + count, it->list_end - it->cur);
> + else
> + pr_err("%pOF: phandle %s needs %d, found %ld\n",
> + it->parent, of_node_full_name(it->node),
> + count, it->list_end - it->cur);
> goto err;
> }
> }
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] of: base: Fix phandle argument length mismatch error message
2021-12-21 8:50 [PATCH 1/2] of: base: Fix phandle argument length mismatch error message Baruch Siach
@ 2021-12-21 14:50 ` kernel test robot
2021-12-21 14:50 ` kernel test robot
1 sibling, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-12-21 14:50 UTC (permalink / raw)
To: Baruch Siach, Rob Herring, Frank Rowand
Cc: kbuild-all, devicetree, Baruch Siach, Florian Fainelli
Hi Baruch,
I love your patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on v5.16-rc6 next-20211220]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Baruch-Siach/of-base-Fix-phandle-argument-length-mismatch-error-message/20211221-165314
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20211221/202112212255.C7mbbAHi-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/2308f6de78c852efe475dcb275b3236b185b03f5
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Baruch-Siach/of-base-Fix-phandle-argument-length-mismatch-error-message/20211221-165314
git checkout 2308f6de78c852efe475dcb275b3236b185b03f5
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash drivers/of/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from include/asm-generic/bug.h:22,
from arch/mips/include/asm/bug.h:42,
from include/linux/bug.h:5,
from arch/mips/include/asm/cmpxchg.h:11,
from arch/mips/include/asm/atomic.h:22,
from include/linux/atomic.h:7,
from include/linux/console.h:17,
from drivers/of/base.c:20:
drivers/of/base.c: In function 'of_phandle_iterator_next':
>> include/linux/kern_levels.h:5:25: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'int' [-Wformat=]
5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
| ^~~~~~
include/linux/printk.h:418:25: note: in definition of macro 'printk_index_wrap'
418 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
include/linux/printk.h:489:9: note: in expansion of macro 'printk'
489 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
include/linux/kern_levels.h:11:25: note: in expansion of macro 'KERN_SOH'
11 | #define KERN_ERR KERN_SOH "3" /* error conditions */
| ^~~~~~~~
include/linux/printk.h:489:16: note: in expansion of macro 'KERN_ERR'
489 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~
drivers/of/base.c:1379:25: note: in expansion of macro 'pr_err'
1379 | pr_err("%pOF: %s = %d found %ld\n",
| ^~~~~~
vim +5 include/linux/kern_levels.h
314ba3520e513a Joe Perches 2012-07-30 4
04d2c8c83d0e3a Joe Perches 2012-07-30 @5 #define KERN_SOH "\001" /* ASCII Start Of Header */
04d2c8c83d0e3a Joe Perches 2012-07-30 6 #define KERN_SOH_ASCII '\001'
04d2c8c83d0e3a Joe Perches 2012-07-30 7
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] of: base: Fix phandle argument length mismatch error message
@ 2021-12-21 14:50 ` kernel test robot
0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-12-21 14:50 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3735 bytes --]
Hi Baruch,
I love your patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on v5.16-rc6 next-20211220]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Baruch-Siach/of-base-Fix-phandle-argument-length-mismatch-error-message/20211221-165314
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20211221/202112212255.C7mbbAHi-lkp(a)intel.com/config)
compiler: mips-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/2308f6de78c852efe475dcb275b3236b185b03f5
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Baruch-Siach/of-base-Fix-phandle-argument-length-mismatch-error-message/20211221-165314
git checkout 2308f6de78c852efe475dcb275b3236b185b03f5
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash drivers/of/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from include/asm-generic/bug.h:22,
from arch/mips/include/asm/bug.h:42,
from include/linux/bug.h:5,
from arch/mips/include/asm/cmpxchg.h:11,
from arch/mips/include/asm/atomic.h:22,
from include/linux/atomic.h:7,
from include/linux/console.h:17,
from drivers/of/base.c:20:
drivers/of/base.c: In function 'of_phandle_iterator_next':
>> include/linux/kern_levels.h:5:25: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'int' [-Wformat=]
5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
| ^~~~~~
include/linux/printk.h:418:25: note: in definition of macro 'printk_index_wrap'
418 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
include/linux/printk.h:489:9: note: in expansion of macro 'printk'
489 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
include/linux/kern_levels.h:11:25: note: in expansion of macro 'KERN_SOH'
11 | #define KERN_ERR KERN_SOH "3" /* error conditions */
| ^~~~~~~~
include/linux/printk.h:489:16: note: in expansion of macro 'KERN_ERR'
489 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~
drivers/of/base.c:1379:25: note: in expansion of macro 'pr_err'
1379 | pr_err("%pOF: %s = %d found %ld\n",
| ^~~~~~
vim +5 include/linux/kern_levels.h
314ba3520e513a Joe Perches 2012-07-30 4
04d2c8c83d0e3a Joe Perches 2012-07-30 @5 #define KERN_SOH "\001" /* ASCII Start Of Header */
04d2c8c83d0e3a Joe Perches 2012-07-30 6 #define KERN_SOH_ASCII '\001'
04d2c8c83d0e3a Joe Perches 2012-07-30 7
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] of: base: Improve argument length mismatch error
2021-12-21 11:24 ` Rob Herring
@ 2021-12-21 16:38 ` Baruch Siach
0 siblings, 0 replies; 6+ messages in thread
From: Baruch Siach @ 2021-12-21 16:38 UTC (permalink / raw)
To: Rob Herring; +Cc: Frank Rowand, devicetree
Hi Rob,
On Tue, Dec 21, 2021 at 07:24:34AM -0400, Rob Herring wrote:
> On Tue, Dec 21, 2021 at 4:51 AM Baruch Siach <baruch@tkos.co.il> wrote:
> >
> > The cells_name field of of_phandle_iterator might be NULL. Use the
> > phandle name instead. With this change we get the more helpful messages:
> >
> > OF: /soc/pinctrl@1000000: phandle pinctrl@1000000 needs 3, found 2
>
> How is printing the same thing twice better?
This is not the same thing. The first node is the parent node (it->parent),
the second is the phandle target (it->node). They happen to be the same in the
case I encountered[1]. I can generate a better example if it helps.
Printing the property name would have been even better. But
of_phandle_iterator_init() does not preserve list_name.
[1] https://lore.kernel.org/all/8a744cfd96aff5754bfdcf7298d208ddca5b319a.1638862030.git.baruch@tkos.co.il/
baruch
> > instead of:
> >
> > OF: /soc/pinctrl@1000000: (null) = 3 found 2
> >
> > That should make DT debugging easier.
> >
> > Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> > ---
> > drivers/of/base.c | 11 ++++++++---
> > 1 file changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/of/base.c b/drivers/of/base.c
> > index 64218c614a85..7c03de370913 100644
> > --- a/drivers/of/base.c
> > +++ b/drivers/of/base.c
> > @@ -1349,9 +1349,14 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it)
> > * property data length
> > */
> > if (it->cur + count > it->list_end) {
> > - pr_err("%pOF: %s = %d found %ld\n",
> > - it->parent, it->cells_name,
> > - count, it->list_end - it->cur);
> > + if (it->cells_name)
> > + pr_err("%pOF: %s = %d found %ld\n",
> > + it->parent, it->cells_name,
> > + count, it->list_end - it->cur);
> > + else
> > + pr_err("%pOF: phandle %s needs %d, found %ld\n",
> > + it->parent, of_node_full_name(it->node),
> > + count, it->list_end - it->cur);
> > goto err;
> > }
> > }
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-12-21 16:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 8:50 [PATCH 1/2] of: base: Fix phandle argument length mismatch error message Baruch Siach
2021-12-21 8:50 ` [PATCH 2/2] of: base: Improve argument length mismatch error Baruch Siach
2021-12-21 11:24 ` Rob Herring
2021-12-21 16:38 ` Baruch Siach
2021-12-21 14:50 ` [PATCH 1/2] of: base: Fix phandle argument length mismatch error message kernel test robot
2021-12-21 14:50 ` kernel test robot
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.