* [PATCH v2 0/3] pinctrl: th1520: Improve code quality
@ 2024-10-06 17:43 Drew Fustini
2024-10-06 17:43 ` [PATCH v2 1/3] pinctrl: th1520: Fix return value for unknown pin error Drew Fustini
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Drew Fustini @ 2024-10-06 17:43 UTC (permalink / raw)
To: Drew Fustini, Guo Ren, Fu Wei, Linus Walleij
Cc: linux-riscv, linux-gpio, linux-kernel, Drew Fustini,
Dan Carpenter
This series contains code quality improvements for the new TH1520
pinctrl driver [1]:
- Fix smatch warning that the return value is not correctly set when an
unknown pin error occurs
- Linus suggested using guarded mutexs so I've converted the thp->mutex
lock to that usage.
- Linus also suggested using a scoped iterator for the DT for-each
child node loop: for_each_available_child_of_node_scoped.
The series is based on the linusw devel branch [2].
[1] https://lore.kernel.org/lkml/CACRpkdavPAv2sPRREQhx_A7EtOj6Ld_n+NcO+vH0QCnfVedXKw@mail.gmail.com/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git/log/?h=devel
Changes since v1:
- Move the scoped iterator conversion to a separate patch and remove the
child put operations as they are no longer needed
- Link: https://lore.kernel.org/lkml/20241005-th1520-pinctrl-fixes-v1-0-5c65dffa0d00@tenstorrent.com/
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
---
Drew Fustini (3):
pinctrl: th1520: Fix return value for unknown pin error
pinctrl: th1520: Convert thp->mutex to guarded mutex
pinctrl: th1520: Convert dt child node loop to scoped iterator
drivers/pinctrl/pinctrl-th1520.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
---
base-commit: 2694868880705e8f6bb61b24b1b25adc42a4a217
change-id: 20241005-th1520-pinctrl-fixes-d20db68387e6
Best regards,
--
Drew Fustini <dfustini@tenstorrent.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/3] pinctrl: th1520: Fix return value for unknown pin error
2024-10-06 17:43 [PATCH v2 0/3] pinctrl: th1520: Improve code quality Drew Fustini
@ 2024-10-06 17:43 ` Drew Fustini
2024-10-06 17:43 ` [PATCH v2 2/3] pinctrl: th1520: Convert thp->mutex to guarded mutex Drew Fustini
2024-10-06 17:43 ` [PATCH v2 3/3] pinctrl: th1520: Convert dt child node loop to scoped iterator Drew Fustini
2 siblings, 0 replies; 6+ messages in thread
From: Drew Fustini @ 2024-10-06 17:43 UTC (permalink / raw)
To: Drew Fustini, Guo Ren, Fu Wei, Linus Walleij
Cc: linux-riscv, linux-gpio, linux-kernel, Drew Fustini,
Dan Carpenter
Fix th1520_pinctrl_dt_node_to_map() to set the return value before
jumping to free_configs when an unknown pin error occurs.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202410022336.xyWlV0Tf-lkp@intel.com/
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
---
drivers/pinctrl/pinctrl-th1520.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1520.c
index 9331f4462480..265a75a78d5a 100644
--- a/drivers/pinctrl/pinctrl-th1520.c
+++ b/drivers/pinctrl/pinctrl-th1520.c
@@ -499,6 +499,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
nmaps = rollback;
dev_err(thp->pctl->dev, "%pOFn.%pOFn: unknown pin '%s'\n",
np, child, pinname);
+ ret = -EINVAL;
goto free_configs;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] pinctrl: th1520: Convert thp->mutex to guarded mutex
2024-10-06 17:43 [PATCH v2 0/3] pinctrl: th1520: Improve code quality Drew Fustini
2024-10-06 17:43 ` [PATCH v2 1/3] pinctrl: th1520: Fix return value for unknown pin error Drew Fustini
@ 2024-10-06 17:43 ` Drew Fustini
2024-10-06 17:43 ` [PATCH v2 3/3] pinctrl: th1520: Convert dt child node loop to scoped iterator Drew Fustini
2 siblings, 0 replies; 6+ messages in thread
From: Drew Fustini @ 2024-10-06 17:43 UTC (permalink / raw)
To: Drew Fustini, Guo Ren, Fu Wei, Linus Walleij
Cc: linux-riscv, linux-gpio, linux-kernel, Drew Fustini
Convert th1520_pinctrl_dt_node_to_map() to use guarded mutex for
thp->mutex.
Suggested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
---
drivers/pinctrl/pinctrl-th1520.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1520.c
index 265a75a78d5a..7ed3f82b9339 100644
--- a/drivers/pinctrl/pinctrl-th1520.c
+++ b/drivers/pinctrl/pinctrl-th1520.c
@@ -444,7 +444,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
return -ENOMEM;
nmaps = 0;
- mutex_lock(&thp->mutex);
+ guard(mutex)(&thp->mutex);
for_each_available_child_of_node(np, child) {
unsigned int rollback = nmaps;
enum th1520_muxtype muxtype;
@@ -531,7 +531,6 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
*maps = map;
*num_maps = nmaps;
- mutex_unlock(&thp->mutex);
return 0;
free_configs:
@@ -539,7 +538,6 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
put_child:
of_node_put(child);
th1520_pinctrl_dt_free_map(pctldev, map, nmaps);
- mutex_unlock(&thp->mutex);
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] pinctrl: th1520: Convert dt child node loop to scoped iterator
2024-10-06 17:43 [PATCH v2 0/3] pinctrl: th1520: Improve code quality Drew Fustini
2024-10-06 17:43 ` [PATCH v2 1/3] pinctrl: th1520: Fix return value for unknown pin error Drew Fustini
2024-10-06 17:43 ` [PATCH v2 2/3] pinctrl: th1520: Convert thp->mutex to guarded mutex Drew Fustini
@ 2024-10-06 17:43 ` Drew Fustini
2024-10-07 12:26 ` kernel test robot
2 siblings, 1 reply; 6+ messages in thread
From: Drew Fustini @ 2024-10-06 17:43 UTC (permalink / raw)
To: Drew Fustini, Guo Ren, Fu Wei, Linus Walleij
Cc: linux-riscv, linux-gpio, linux-kernel, Drew Fustini
Convert th1520_pinctrl_dt_node_to_map() to use a scoped iterator with
for_each_available_child_of_node_scoped(). As a result, there is no need
to call of_node_put() anymore. The put_child label has been renamed to
free_map which is now a more accurate description.
Suggested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
---
drivers/pinctrl/pinctrl-th1520.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1520.c
index 7ed3f82b9339..286c6b2b0b13 100644
--- a/drivers/pinctrl/pinctrl-th1520.c
+++ b/drivers/pinctrl/pinctrl-th1520.c
@@ -425,11 +425,10 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
int ret;
nmaps = 0;
- for_each_available_child_of_node(np, child) {
+ for_each_available_child_of_node_scoped(np, child) {
int npins = of_property_count_strings(child, "pins");
if (npins <= 0) {
- of_node_put(child);
dev_err(thp->pctl->dev, "no pins selected for %pOFn.%pOFn\n",
np, child);
return -EINVAL;
@@ -445,7 +444,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
nmaps = 0;
guard(mutex)(&thp->mutex);
- for_each_available_child_of_node(np, child) {
+ for_each_available_child_of_node_scoped(np, child) {
unsigned int rollback = nmaps;
enum th1520_muxtype muxtype;
struct property *prop;
@@ -458,7 +457,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
if (ret) {
dev_err(thp->pctl->dev, "%pOFn.%pOFn: error parsing pin config\n",
np, child);
- goto put_child;
+ goto free_map;
}
if (!of_property_read_string(child, "function", &funcname)) {
@@ -524,7 +523,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
npins, (void *)muxtype);
if (ret < 0) {
dev_err(thp->pctl->dev, "error adding function %s\n", funcname);
- goto put_child;
+ goto free_map;
}
}
}
@@ -535,8 +534,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
free_configs:
kfree(configs);
-put_child:
- of_node_put(child);
+free_map:
th1520_pinctrl_dt_free_map(pctldev, map, nmaps);
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/3] pinctrl: th1520: Convert dt child node loop to scoped iterator
2024-10-06 17:43 ` [PATCH v2 3/3] pinctrl: th1520: Convert dt child node loop to scoped iterator Drew Fustini
@ 2024-10-07 12:26 ` kernel test robot
2024-10-07 18:03 ` Drew Fustini
0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2024-10-07 12:26 UTC (permalink / raw)
To: Drew Fustini, Drew Fustini, Guo Ren, Fu Wei, Linus Walleij
Cc: oe-kbuild-all, linux-riscv, linux-gpio, linux-kernel
Hi Drew,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 2694868880705e8f6bb61b24b1b25adc42a4a217]
url: https://github.com/intel-lab-lkp/linux/commits/Drew-Fustini/pinctrl-th1520-Fix-return-value-for-unknown-pin-error/20241007-014953
base: 2694868880705e8f6bb61b24b1b25adc42a4a217
patch link: https://lore.kernel.org/r/20241006-th1520-pinctrl-fixes-v2-3-b1822ae3a6d7%40tenstorrent.com
patch subject: [PATCH v2 3/3] pinctrl: th1520: Convert dt child node loop to scoped iterator
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20241007/202410072033.XpRqZ8nz-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241007/202410072033.XpRqZ8nz-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410072033.XpRqZ8nz-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/pinctrl/pinctrl-th1520.c: In function 'th1520_pinctrl_dt_node_to_map':
>> drivers/pinctrl/pinctrl-th1520.c:420:29: warning: unused variable 'child' [-Wunused-variable]
420 | struct device_node *child;
| ^~~~~
vim +/child +420 drivers/pinctrl/pinctrl-th1520.c
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 413
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 414 static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 415 struct device_node *np,
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 416 struct pinctrl_map **maps,
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 417 unsigned int *num_maps)
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 418 {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 419 struct th1520_pinctrl *thp = pinctrl_dev_get_drvdata(pctldev);
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 @420 struct device_node *child;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 421 struct pinctrl_map *map;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 422 unsigned long *configs;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 423 unsigned int nconfigs;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 424 unsigned int nmaps;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 425 int ret;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 426
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 427 nmaps = 0;
1a1dcc4caac257 Drew Fustini 2024-10-06 428 for_each_available_child_of_node_scoped(np, child) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 429 int npins = of_property_count_strings(child, "pins");
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 430
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 431 if (npins <= 0) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 432 dev_err(thp->pctl->dev, "no pins selected for %pOFn.%pOFn\n",
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 433 np, child);
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 434 return -EINVAL;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 435 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 436 nmaps += npins;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 437 if (of_property_present(child, "function"))
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 438 nmaps += npins;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 439 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 440
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 441 map = kcalloc(nmaps, sizeof(*map), GFP_KERNEL);
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 442 if (!map)
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 443 return -ENOMEM;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 444
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 445 nmaps = 0;
9aae170bf6c30e Drew Fustini 2024-10-06 446 guard(mutex)(&thp->mutex);
1a1dcc4caac257 Drew Fustini 2024-10-06 447 for_each_available_child_of_node_scoped(np, child) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 448 unsigned int rollback = nmaps;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 449 enum th1520_muxtype muxtype;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 450 struct property *prop;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 451 const char *funcname;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 452 const char **pgnames;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 453 const char *pinname;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 454 int npins;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 455
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 456 ret = pinconf_generic_parse_dt_config(child, pctldev, &configs, &nconfigs);
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 457 if (ret) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 458 dev_err(thp->pctl->dev, "%pOFn.%pOFn: error parsing pin config\n",
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 459 np, child);
1a1dcc4caac257 Drew Fustini 2024-10-06 460 goto free_map;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 461 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 462
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 463 if (!of_property_read_string(child, "function", &funcname)) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 464 muxtype = th1520_muxtype_get(funcname);
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 465 if (!muxtype) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 466 dev_err(thp->pctl->dev, "%pOFn.%pOFn: unknown function '%s'\n",
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 467 np, child, funcname);
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 468 ret = -EINVAL;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 469 goto free_configs;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 470 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 471
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 472 funcname = devm_kasprintf(thp->pctl->dev, GFP_KERNEL, "%pOFn.%pOFn",
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 473 np, child);
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 474 if (!funcname) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 475 ret = -ENOMEM;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 476 goto free_configs;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 477 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 478
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 479 npins = of_property_count_strings(child, "pins");
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 480 pgnames = devm_kcalloc(thp->pctl->dev, npins, sizeof(*pgnames), GFP_KERNEL);
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 481 if (!pgnames) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 482 ret = -ENOMEM;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 483 goto free_configs;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 484 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 485 } else {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 486 funcname = NULL;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 487 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 488
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 489 npins = 0;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 490 of_property_for_each_string(child, "pins", prop, pinname) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 491 unsigned int i;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 492
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 493 for (i = 0; i < thp->desc.npins; i++) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 494 if (!strcmp(pinname, thp->desc.pins[i].name))
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 495 break;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 496 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 497 if (i == thp->desc.npins) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 498 nmaps = rollback;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 499 dev_err(thp->pctl->dev, "%pOFn.%pOFn: unknown pin '%s'\n",
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 500 np, child, pinname);
08f5dfea548d37 Drew Fustini 2024-10-06 501 ret = -EINVAL;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 502 goto free_configs;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 503 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 504
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 505 if (nconfigs) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 506 map[nmaps].type = PIN_MAP_TYPE_CONFIGS_PIN;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 507 map[nmaps].data.configs.group_or_pin = thp->desc.pins[i].name;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 508 map[nmaps].data.configs.configs = configs;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 509 map[nmaps].data.configs.num_configs = nconfigs;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 510 nmaps += 1;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 511 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 512 if (funcname) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 513 pgnames[npins++] = thp->desc.pins[i].name;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 514 map[nmaps].type = PIN_MAP_TYPE_MUX_GROUP;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 515 map[nmaps].data.mux.function = funcname;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 516 map[nmaps].data.mux.group = thp->desc.pins[i].name;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 517 nmaps += 1;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 518 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 519 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 520
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 521 if (funcname) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 522 ret = pinmux_generic_add_function(pctldev, funcname, pgnames,
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 523 npins, (void *)muxtype);
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 524 if (ret < 0) {
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 525 dev_err(thp->pctl->dev, "error adding function %s\n", funcname);
1a1dcc4caac257 Drew Fustini 2024-10-06 526 goto free_map;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 527 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 528 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 529 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 530
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 531 *maps = map;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 532 *num_maps = nmaps;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 533 return 0;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 534
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 535 free_configs:
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 536 kfree(configs);
1a1dcc4caac257 Drew Fustini 2024-10-06 537 free_map:
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 538 th1520_pinctrl_dt_free_map(pctldev, map, nmaps);
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 539 return ret;
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 540 }
bed5cd6f8a9883 Emil Renner Berthing 2024-09-30 541
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/3] pinctrl: th1520: Convert dt child node loop to scoped iterator
2024-10-07 12:26 ` kernel test robot
@ 2024-10-07 18:03 ` Drew Fustini
0 siblings, 0 replies; 6+ messages in thread
From: Drew Fustini @ 2024-10-07 18:03 UTC (permalink / raw)
To: kernel test robot
Cc: Drew Fustini, Guo Ren, Fu Wei, Linus Walleij, oe-kbuild-all,
linux-riscv, linux-gpio, linux-kernel
On Mon, Oct 07, 2024 at 08:26:28PM +0800, kernel test robot wrote:
> Hi Drew,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on 2694868880705e8f6bb61b24b1b25adc42a4a217]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Drew-Fustini/pinctrl-th1520-Fix-return-value-for-unknown-pin-error/20241007-014953
> base: 2694868880705e8f6bb61b24b1b25adc42a4a217
> patch link: https://lore.kernel.org/r/20241006-th1520-pinctrl-fixes-v2-3-b1822ae3a6d7%40tenstorrent.com
> patch subject: [PATCH v2 3/3] pinctrl: th1520: Convert dt child node loop to scoped iterator
> config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20241007/202410072033.XpRqZ8nz-lkp@intel.com/config)
> compiler: alpha-linux-gcc (GCC) 13.3.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241007/202410072033.XpRqZ8nz-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202410072033.XpRqZ8nz-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> drivers/pinctrl/pinctrl-th1520.c: In function 'th1520_pinctrl_dt_node_to_map':
> >> drivers/pinctrl/pinctrl-th1520.c:420:29: warning: unused variable 'child' [-Wunused-variable]
> 420 | struct device_node *child;
> | ^~~~~
It seems this is because the scoped iterator declares *child in the
macro and thus no separate declaration is needed:
#define for_each_available_child_of_node_scoped(parent, child) \
for (struct device_node *child __free(device_node) = \
of_get_next_available_child(parent, NULL); \
child != NULL; \
child = of_get_next_available_child(parent, child))
I'll fix in next revision.
Thanks,
Drew
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-10-07 18:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-06 17:43 [PATCH v2 0/3] pinctrl: th1520: Improve code quality Drew Fustini
2024-10-06 17:43 ` [PATCH v2 1/3] pinctrl: th1520: Fix return value for unknown pin error Drew Fustini
2024-10-06 17:43 ` [PATCH v2 2/3] pinctrl: th1520: Convert thp->mutex to guarded mutex Drew Fustini
2024-10-06 17:43 ` [PATCH v2 3/3] pinctrl: th1520: Convert dt child node loop to scoped iterator Drew Fustini
2024-10-07 12:26 ` kernel test robot
2024-10-07 18:03 ` Drew Fustini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).