* [bp:edac-cxl 2/5] drivers/edac/edac_device.c:705 edac_dev_register() error: uninitialized symbol 'ret'.
@ 2025-02-25 2:35 kernel test robot
0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2025-02-25 2:35 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Shiju Jose <shiju.jose@huawei.com>
CC: "Borislav Petkov (AMD)" <bp@alien8.de>
CC: Jonathan Cameron <Jonathan.Cameron@huawei.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git edac-cxl
head: 4fab25b62bc682c0df886d97dcb106d4989c9ff1
commit: e777719d5bec32af859990456f4b0e0e362f425a [2/5] EDAC: Add scrub control feature
:::::: branch date: 15 hours ago
:::::: commit date: 19 hours ago
config: i386-randconfig-141-20250225 (https://download.01.org/0day-ci/archive/20250225/202502251009.0sGkolEJ-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202502251009.0sGkolEJ-lkp@intel.com/
smatch warnings:
drivers/edac/edac_device.c:705 edac_dev_register() error: uninitialized symbol 'ret'.
vim +/ret +705 drivers/edac/edac_device.c
9222ad0e3fd4c35 Shiju Jose 2025-02-12 592
9222ad0e3fd4c35 Shiju Jose 2025-02-12 593 /**
9222ad0e3fd4c35 Shiju Jose 2025-02-12 594 * edac_dev_register - register device for RAS features with EDAC
9222ad0e3fd4c35 Shiju Jose 2025-02-12 595 * @parent: parent device.
9222ad0e3fd4c35 Shiju Jose 2025-02-12 596 * @name: name for the folder in the /sys/bus/edac/devices/,
9222ad0e3fd4c35 Shiju Jose 2025-02-12 597 * which is derived from the parent device.
9222ad0e3fd4c35 Shiju Jose 2025-02-12 598 * For e.g. /sys/bus/edac/devices/cxl_mem0/
9222ad0e3fd4c35 Shiju Jose 2025-02-12 599 * @private: parent driver's data to store in the context if any.
9222ad0e3fd4c35 Shiju Jose 2025-02-12 600 * @num_features: number of RAS features to register.
9222ad0e3fd4c35 Shiju Jose 2025-02-12 601 * @ras_features: list of RAS features to register.
9222ad0e3fd4c35 Shiju Jose 2025-02-12 602 *
9222ad0e3fd4c35 Shiju Jose 2025-02-12 603 * Return:
9222ad0e3fd4c35 Shiju Jose 2025-02-12 604 * * %0 - Success.
9222ad0e3fd4c35 Shiju Jose 2025-02-12 605 * * %-EINVAL - Invalid parameters passed.
9222ad0e3fd4c35 Shiju Jose 2025-02-12 606 * * %-ENOMEM - Dynamic memory allocation failed.
9222ad0e3fd4c35 Shiju Jose 2025-02-12 607 *
9222ad0e3fd4c35 Shiju Jose 2025-02-12 608 */
9222ad0e3fd4c35 Shiju Jose 2025-02-12 609 int edac_dev_register(struct device *parent, char *name,
9222ad0e3fd4c35 Shiju Jose 2025-02-12 610 void *private, int num_features,
9222ad0e3fd4c35 Shiju Jose 2025-02-12 611 const struct edac_dev_feature *ras_features)
9222ad0e3fd4c35 Shiju Jose 2025-02-12 612 {
9222ad0e3fd4c35 Shiju Jose 2025-02-12 613 const struct attribute_group **ras_attr_groups;
e777719d5bec32a Shiju Jose 2025-02-12 614 struct edac_dev_data *dev_data;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 615 struct edac_dev_feat_ctx *ctx;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 616 int attr_gcnt = 0;
e777719d5bec32a Shiju Jose 2025-02-12 617 int scrub_cnt = 0;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 618 int ret, feat;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 619
9222ad0e3fd4c35 Shiju Jose 2025-02-12 620 if (!parent || !name || !num_features || !ras_features)
9222ad0e3fd4c35 Shiju Jose 2025-02-12 621 return -EINVAL;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 622
9222ad0e3fd4c35 Shiju Jose 2025-02-12 623 /* Double parse to make space for attributes */
9222ad0e3fd4c35 Shiju Jose 2025-02-12 624 for (feat = 0; feat < num_features; feat++) {
9222ad0e3fd4c35 Shiju Jose 2025-02-12 625 switch (ras_features[feat].ft_type) {
e777719d5bec32a Shiju Jose 2025-02-12 626 case RAS_FEAT_SCRUB:
e777719d5bec32a Shiju Jose 2025-02-12 627 attr_gcnt++;
e777719d5bec32a Shiju Jose 2025-02-12 628 scrub_cnt++;
e777719d5bec32a Shiju Jose 2025-02-12 629 break;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 630 default:
9222ad0e3fd4c35 Shiju Jose 2025-02-12 631 return -EINVAL;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 632 }
9222ad0e3fd4c35 Shiju Jose 2025-02-12 633 }
9222ad0e3fd4c35 Shiju Jose 2025-02-12 634
9222ad0e3fd4c35 Shiju Jose 2025-02-12 635 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 636 if (!ctx)
9222ad0e3fd4c35 Shiju Jose 2025-02-12 637 return -ENOMEM;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 638
9222ad0e3fd4c35 Shiju Jose 2025-02-12 639 ras_attr_groups = kcalloc(attr_gcnt + 1, sizeof(*ras_attr_groups), GFP_KERNEL);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 640 if (!ras_attr_groups) {
9222ad0e3fd4c35 Shiju Jose 2025-02-12 641 ret = -ENOMEM;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 642 goto ctx_free;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 643 }
9222ad0e3fd4c35 Shiju Jose 2025-02-12 644
e777719d5bec32a Shiju Jose 2025-02-12 645 if (scrub_cnt) {
e777719d5bec32a Shiju Jose 2025-02-12 646 ctx->scrub = kcalloc(scrub_cnt, sizeof(*ctx->scrub), GFP_KERNEL);
e777719d5bec32a Shiju Jose 2025-02-12 647 if (!ctx->scrub) {
e777719d5bec32a Shiju Jose 2025-02-12 648 ret = -ENOMEM;
e777719d5bec32a Shiju Jose 2025-02-12 649 goto groups_free;
e777719d5bec32a Shiju Jose 2025-02-12 650 }
e777719d5bec32a Shiju Jose 2025-02-12 651 }
e777719d5bec32a Shiju Jose 2025-02-12 652
9222ad0e3fd4c35 Shiju Jose 2025-02-12 653 attr_gcnt = 0;
e777719d5bec32a Shiju Jose 2025-02-12 654 scrub_cnt = 0;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 655 for (feat = 0; feat < num_features; feat++, ras_features++) {
9222ad0e3fd4c35 Shiju Jose 2025-02-12 656 switch (ras_features->ft_type) {
e777719d5bec32a Shiju Jose 2025-02-12 657 case RAS_FEAT_SCRUB:
e777719d5bec32a Shiju Jose 2025-02-12 658 if (!ras_features->scrub_ops ||
e777719d5bec32a Shiju Jose 2025-02-12 659 scrub_cnt != ras_features->instance)
e777719d5bec32a Shiju Jose 2025-02-12 660 goto data_mem_free;
e777719d5bec32a Shiju Jose 2025-02-12 661
e777719d5bec32a Shiju Jose 2025-02-12 662 dev_data = &ctx->scrub[scrub_cnt];
e777719d5bec32a Shiju Jose 2025-02-12 663 dev_data->instance = scrub_cnt;
e777719d5bec32a Shiju Jose 2025-02-12 664 dev_data->scrub_ops = ras_features->scrub_ops;
e777719d5bec32a Shiju Jose 2025-02-12 665 dev_data->private = ras_features->ctx;
e777719d5bec32a Shiju Jose 2025-02-12 666 ret = edac_scrub_get_desc(parent, &ras_attr_groups[attr_gcnt],
e777719d5bec32a Shiju Jose 2025-02-12 667 ras_features->instance);
e777719d5bec32a Shiju Jose 2025-02-12 668 if (ret)
e777719d5bec32a Shiju Jose 2025-02-12 669 goto data_mem_free;
e777719d5bec32a Shiju Jose 2025-02-12 670
e777719d5bec32a Shiju Jose 2025-02-12 671 scrub_cnt++;
e777719d5bec32a Shiju Jose 2025-02-12 672 attr_gcnt++;
e777719d5bec32a Shiju Jose 2025-02-12 673 break;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 674 default:
9222ad0e3fd4c35 Shiju Jose 2025-02-12 675 ret = -EINVAL;
e777719d5bec32a Shiju Jose 2025-02-12 676 goto data_mem_free;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 677 }
9222ad0e3fd4c35 Shiju Jose 2025-02-12 678 }
9222ad0e3fd4c35 Shiju Jose 2025-02-12 679
9222ad0e3fd4c35 Shiju Jose 2025-02-12 680 ctx->dev.parent = parent;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 681 ctx->dev.bus = edac_get_sysfs_subsys();
9222ad0e3fd4c35 Shiju Jose 2025-02-12 682 ctx->dev.type = &edac_dev_type;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 683 ctx->dev.groups = ras_attr_groups;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 684 ctx->private = private;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 685 dev_set_drvdata(&ctx->dev, ctx);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 686
9222ad0e3fd4c35 Shiju Jose 2025-02-12 687 ret = dev_set_name(&ctx->dev, name);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 688 if (ret)
e777719d5bec32a Shiju Jose 2025-02-12 689 goto data_mem_free;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 690
9222ad0e3fd4c35 Shiju Jose 2025-02-12 691 ret = device_register(&ctx->dev);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 692 if (ret) {
9222ad0e3fd4c35 Shiju Jose 2025-02-12 693 put_device(&ctx->dev);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 694 return ret;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 695 }
9222ad0e3fd4c35 Shiju Jose 2025-02-12 696
9222ad0e3fd4c35 Shiju Jose 2025-02-12 697 return devm_add_action_or_reset(parent, edac_dev_unreg, &ctx->dev);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 698
e777719d5bec32a Shiju Jose 2025-02-12 699 data_mem_free:
e777719d5bec32a Shiju Jose 2025-02-12 700 kfree(ctx->scrub);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 701 groups_free:
9222ad0e3fd4c35 Shiju Jose 2025-02-12 702 kfree(ras_attr_groups);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 703 ctx_free:
9222ad0e3fd4c35 Shiju Jose 2025-02-12 704 kfree(ctx);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 @705 return ret;
:::::: The code at line 705 was first introduced by commit
:::::: 9222ad0e3fd4c35a63e59bba1c297f13e70cdc1d EDAC: Add support for EDAC device features control
:::::: TO: Shiju Jose <shiju.jose@huawei.com>
:::::: CC: Borislav Petkov (AMD) <bp@alien8.de>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bp:edac-cxl 2/5] drivers/edac/edac_device.c:705 edac_dev_register() error: uninitialized symbol 'ret'.
@ 2025-02-25 7:46 Dan Carpenter
2025-02-25 14:54 ` Borislav Petkov
0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2025-02-25 7:46 UTC (permalink / raw)
To: oe-kbuild, Shiju Jose
Cc: lkp, oe-kbuild-all, Borislav Petkov (AMD), Jonathan Cameron
tree: https://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git edac-cxl
head: 4fab25b62bc682c0df886d97dcb106d4989c9ff1
commit: e777719d5bec32af859990456f4b0e0e362f425a [2/5] EDAC: Add scrub control feature
config: i386-randconfig-141-20250225 (https://download.01.org/0day-ci/archive/20250225/202502251009.0sGkolEJ-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
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>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202502251009.0sGkolEJ-lkp@intel.com/
smatch warnings:
drivers/edac/edac_device.c:705 edac_dev_register() error: uninitialized symbol 'ret'.
vim +/ret +705 drivers/edac/edac_device.c
9222ad0e3fd4c35 Shiju Jose 2025-02-12 609 int edac_dev_register(struct device *parent, char *name,
9222ad0e3fd4c35 Shiju Jose 2025-02-12 610 void *private, int num_features,
9222ad0e3fd4c35 Shiju Jose 2025-02-12 611 const struct edac_dev_feature *ras_features)
9222ad0e3fd4c35 Shiju Jose 2025-02-12 612 {
9222ad0e3fd4c35 Shiju Jose 2025-02-12 613 const struct attribute_group **ras_attr_groups;
e777719d5bec32a Shiju Jose 2025-02-12 614 struct edac_dev_data *dev_data;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 615 struct edac_dev_feat_ctx *ctx;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 616 int attr_gcnt = 0;
e777719d5bec32a Shiju Jose 2025-02-12 617 int scrub_cnt = 0;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 618 int ret, feat;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 619
9222ad0e3fd4c35 Shiju Jose 2025-02-12 620 if (!parent || !name || !num_features || !ras_features)
9222ad0e3fd4c35 Shiju Jose 2025-02-12 621 return -EINVAL;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 622
9222ad0e3fd4c35 Shiju Jose 2025-02-12 623 /* Double parse to make space for attributes */
9222ad0e3fd4c35 Shiju Jose 2025-02-12 624 for (feat = 0; feat < num_features; feat++) {
9222ad0e3fd4c35 Shiju Jose 2025-02-12 625 switch (ras_features[feat].ft_type) {
e777719d5bec32a Shiju Jose 2025-02-12 626 case RAS_FEAT_SCRUB:
e777719d5bec32a Shiju Jose 2025-02-12 627 attr_gcnt++;
e777719d5bec32a Shiju Jose 2025-02-12 628 scrub_cnt++;
e777719d5bec32a Shiju Jose 2025-02-12 629 break;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 630 default:
9222ad0e3fd4c35 Shiju Jose 2025-02-12 631 return -EINVAL;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 632 }
9222ad0e3fd4c35 Shiju Jose 2025-02-12 633 }
9222ad0e3fd4c35 Shiju Jose 2025-02-12 634
9222ad0e3fd4c35 Shiju Jose 2025-02-12 635 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 636 if (!ctx)
9222ad0e3fd4c35 Shiju Jose 2025-02-12 637 return -ENOMEM;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 638
9222ad0e3fd4c35 Shiju Jose 2025-02-12 639 ras_attr_groups = kcalloc(attr_gcnt + 1, sizeof(*ras_attr_groups), GFP_KERNEL);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 640 if (!ras_attr_groups) {
9222ad0e3fd4c35 Shiju Jose 2025-02-12 641 ret = -ENOMEM;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 642 goto ctx_free;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 643 }
9222ad0e3fd4c35 Shiju Jose 2025-02-12 644
e777719d5bec32a Shiju Jose 2025-02-12 645 if (scrub_cnt) {
e777719d5bec32a Shiju Jose 2025-02-12 646 ctx->scrub = kcalloc(scrub_cnt, sizeof(*ctx->scrub), GFP_KERNEL);
e777719d5bec32a Shiju Jose 2025-02-12 647 if (!ctx->scrub) {
e777719d5bec32a Shiju Jose 2025-02-12 648 ret = -ENOMEM;
e777719d5bec32a Shiju Jose 2025-02-12 649 goto groups_free;
e777719d5bec32a Shiju Jose 2025-02-12 650 }
e777719d5bec32a Shiju Jose 2025-02-12 651 }
e777719d5bec32a Shiju Jose 2025-02-12 652
9222ad0e3fd4c35 Shiju Jose 2025-02-12 653 attr_gcnt = 0;
e777719d5bec32a Shiju Jose 2025-02-12 654 scrub_cnt = 0;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 655 for (feat = 0; feat < num_features; feat++, ras_features++) {
9222ad0e3fd4c35 Shiju Jose 2025-02-12 656 switch (ras_features->ft_type) {
e777719d5bec32a Shiju Jose 2025-02-12 657 case RAS_FEAT_SCRUB:
e777719d5bec32a Shiju Jose 2025-02-12 658 if (!ras_features->scrub_ops ||
e777719d5bec32a Shiju Jose 2025-02-12 659 scrub_cnt != ras_features->instance)
e777719d5bec32a Shiju Jose 2025-02-12 660 goto data_mem_free;
ret = -EINVAL?
e777719d5bec32a Shiju Jose 2025-02-12 661
e777719d5bec32a Shiju Jose 2025-02-12 662 dev_data = &ctx->scrub[scrub_cnt];
e777719d5bec32a Shiju Jose 2025-02-12 663 dev_data->instance = scrub_cnt;
e777719d5bec32a Shiju Jose 2025-02-12 664 dev_data->scrub_ops = ras_features->scrub_ops;
e777719d5bec32a Shiju Jose 2025-02-12 665 dev_data->private = ras_features->ctx;
e777719d5bec32a Shiju Jose 2025-02-12 666 ret = edac_scrub_get_desc(parent, &ras_attr_groups[attr_gcnt],
e777719d5bec32a Shiju Jose 2025-02-12 667 ras_features->instance);
e777719d5bec32a Shiju Jose 2025-02-12 668 if (ret)
e777719d5bec32a Shiju Jose 2025-02-12 669 goto data_mem_free;
e777719d5bec32a Shiju Jose 2025-02-12 670
e777719d5bec32a Shiju Jose 2025-02-12 671 scrub_cnt++;
e777719d5bec32a Shiju Jose 2025-02-12 672 attr_gcnt++;
e777719d5bec32a Shiju Jose 2025-02-12 673 break;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 674 default:
9222ad0e3fd4c35 Shiju Jose 2025-02-12 675 ret = -EINVAL;
e777719d5bec32a Shiju Jose 2025-02-12 676 goto data_mem_free;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 677 }
9222ad0e3fd4c35 Shiju Jose 2025-02-12 678 }
9222ad0e3fd4c35 Shiju Jose 2025-02-12 679
9222ad0e3fd4c35 Shiju Jose 2025-02-12 680 ctx->dev.parent = parent;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 681 ctx->dev.bus = edac_get_sysfs_subsys();
9222ad0e3fd4c35 Shiju Jose 2025-02-12 682 ctx->dev.type = &edac_dev_type;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 683 ctx->dev.groups = ras_attr_groups;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 684 ctx->private = private;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 685 dev_set_drvdata(&ctx->dev, ctx);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 686
9222ad0e3fd4c35 Shiju Jose 2025-02-12 687 ret = dev_set_name(&ctx->dev, name);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 688 if (ret)
e777719d5bec32a Shiju Jose 2025-02-12 689 goto data_mem_free;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 690
9222ad0e3fd4c35 Shiju Jose 2025-02-12 691 ret = device_register(&ctx->dev);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 692 if (ret) {
9222ad0e3fd4c35 Shiju Jose 2025-02-12 693 put_device(&ctx->dev);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 694 return ret;
9222ad0e3fd4c35 Shiju Jose 2025-02-12 695 }
9222ad0e3fd4c35 Shiju Jose 2025-02-12 696
9222ad0e3fd4c35 Shiju Jose 2025-02-12 697 return devm_add_action_or_reset(parent, edac_dev_unreg, &ctx->dev);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 698
e777719d5bec32a Shiju Jose 2025-02-12 699 data_mem_free:
e777719d5bec32a Shiju Jose 2025-02-12 700 kfree(ctx->scrub);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 701 groups_free:
9222ad0e3fd4c35 Shiju Jose 2025-02-12 702 kfree(ras_attr_groups);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 703 ctx_free:
9222ad0e3fd4c35 Shiju Jose 2025-02-12 704 kfree(ctx);
9222ad0e3fd4c35 Shiju Jose 2025-02-12 @705 return ret;
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [bp:edac-cxl 2/5] drivers/edac/edac_device.c:705 edac_dev_register() error: uninitialized symbol 'ret'.
2025-02-25 7:46 [bp:edac-cxl 2/5] drivers/edac/edac_device.c:705 edac_dev_register() error: uninitialized symbol 'ret' Dan Carpenter
@ 2025-02-25 14:54 ` Borislav Petkov
2025-02-25 18:27 ` Shiju Jose
0 siblings, 1 reply; 7+ messages in thread
From: Borislav Petkov @ 2025-02-25 14:54 UTC (permalink / raw)
To: Dan Carpenter, Shiju Jose; +Cc: oe-kbuild, lkp, oe-kbuild-all, Jonathan Cameron
On Tue, Feb 25, 2025 at 10:46:48AM +0300, Dan Carpenter wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git edac-cxl
> head: 4fab25b62bc682c0df886d97dcb106d4989c9ff1
> commit: e777719d5bec32af859990456f4b0e0e362f425a [2/5] EDAC: Add scrub control feature
> config: i386-randconfig-141-20250225 (https://download.01.org/0day-ci/archive/20250225/202502251009.0sGkolEJ-lkp@intel.com/config)
> compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
>
> 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>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202502251009.0sGkolEJ-lkp@intel.com/
>
> smatch warnings:
> drivers/edac/edac_device.c:705 edac_dev_register() error: uninitialized symbol 'ret'.
Thanks for reporting.
I went through the whole set and did some scrubbing of retvals. And that
edac_dev_register() is already a mess. But cleaning that up is for another
day.
So, Shiju, I've pushed a edac-cxl2 branch, please run it again.
Thx.
Full diff of the changes I've done:
---
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index 081f77b1f125..16611515ab34 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -581,7 +581,7 @@ static void edac_dev_release(struct device *dev)
kfree(ctx);
}
-const struct device_type edac_dev_type = {
+static const struct device_type edac_dev_type = {
.name = "edac_dev",
.release = edac_dev_release,
};
@@ -616,8 +616,9 @@ int edac_dev_register(struct device *parent, char *name,
struct edac_dev_feat_ctx *ctx;
int mem_repair_cnt = 0;
int attr_gcnt = 0;
+ int ret = -ENOMEM;
int scrub_cnt = 0;
- int ret, feat;
+ int feat;
if (!parent || !name || !num_features || !ras_features)
return -EINVAL;
@@ -646,25 +647,19 @@ int edac_dev_register(struct device *parent, char *name,
return -ENOMEM;
ras_attr_groups = kcalloc(attr_gcnt + 1, sizeof(*ras_attr_groups), GFP_KERNEL);
- if (!ras_attr_groups) {
- ret = -ENOMEM;
+ if (!ras_attr_groups)
goto ctx_free;
- }
if (scrub_cnt) {
ctx->scrub = kcalloc(scrub_cnt, sizeof(*ctx->scrub), GFP_KERNEL);
- if (!ctx->scrub) {
- ret = -ENOMEM;
+ if (!ctx->scrub)
goto groups_free;
- }
}
if (mem_repair_cnt) {
ctx->mem_repair = kcalloc(mem_repair_cnt, sizeof(*ctx->mem_repair), GFP_KERNEL);
- if (!ctx->mem_repair) {
- ret = -ENOMEM;
+ if (!ctx->mem_repair)
goto data_mem_free;
- }
}
attr_gcnt = 0;
@@ -673,9 +668,10 @@ int edac_dev_register(struct device *parent, char *name,
for (feat = 0; feat < num_features; feat++, ras_features++) {
switch (ras_features->ft_type) {
case RAS_FEAT_SCRUB:
- if (!ras_features->scrub_ops ||
- scrub_cnt != ras_features->instance)
+ if (!ras_features->scrub_ops || scrub_cnt != ras_features->instance) {
+ ret = -EINVAL;
goto data_mem_free;
+ }
dev_data = &ctx->scrub[scrub_cnt];
dev_data->instance = scrub_cnt;
@@ -690,8 +686,10 @@ int edac_dev_register(struct device *parent, char *name,
attr_gcnt++;
break;
case RAS_FEAT_ECS:
- if (!ras_features->ecs_ops)
+ if (!ras_features->ecs_ops) {
+ ret = -EINVAL;
goto data_mem_free;
+ }
dev_data = &ctx->ecs;
dev_data->ecs_ops = ras_features->ecs_ops;
@@ -705,8 +703,10 @@ int edac_dev_register(struct device *parent, char *name,
break;
case RAS_FEAT_MEM_REPAIR:
if (!ras_features->mem_repair_ops ||
- mem_repair_cnt != ras_features->instance)
+ mem_repair_cnt != ras_features->instance) {
+ ret = -EINVAL;
goto data_mem_free;
+ }
dev_data = &ctx->mem_repair[mem_repair_cnt];
dev_data->instance = mem_repair_cnt;
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [bp:edac-cxl 2/5] drivers/edac/edac_device.c:705 edac_dev_register() error: uninitialized symbol 'ret'.
2025-02-25 14:54 ` Borislav Petkov
@ 2025-02-25 18:27 ` Shiju Jose
2025-02-27 10:37 ` Borislav Petkov
0 siblings, 1 reply; 7+ messages in thread
From: Shiju Jose @ 2025-02-25 18:27 UTC (permalink / raw)
To: Borislav Petkov, Dan Carpenter
Cc: oe-kbuild@lists.linux.dev, lkp@intel.com,
oe-kbuild-all@lists.linux.dev, Jonathan Cameron
>-----Original Message-----
>From: Borislav Petkov <bp@alien8.de>
>Sent: 25 February 2025 14:54
>To: Dan Carpenter <dan.carpenter@linaro.org>; Shiju Jose
><shiju.jose@huawei.com>
>Cc: oe-kbuild@lists.linux.dev; lkp@intel.com; oe-kbuild-all@lists.linux.dev;
>Jonathan Cameron <jonathan.cameron@huawei.com>
>Subject: Re: [bp:edac-cxl 2/5] drivers/edac/edac_device.c:705
>edac_dev_register() error: uninitialized symbol 'ret'.
>
>On Tue, Feb 25, 2025 at 10:46:48AM +0300, Dan Carpenter wrote:
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git edac-cxl
>> head: 4fab25b62bc682c0df886d97dcb106d4989c9ff1
>> commit: e777719d5bec32af859990456f4b0e0e362f425a [2/5] EDAC: Add
>scrub
>> control feature
>> config: i386-randconfig-141-20250225
>> (https://download.01.org/0day-ci/archive/20250225/202502251009.0sGkolE
>> J-lkp@intel.com/config)
>> compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project
>> cd708029e0b2869e80abe31ddb175f7c35361f90)
>>
>> 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>
>> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
>> | Closes:
>> | https://lore.kernel.org/r/202502251009.0sGkolEJ-lkp@intel.com/
>>
>> smatch warnings:
>> drivers/edac/edac_device.c:705 edac_dev_register() error: uninitialized
>symbol 'ret'.
>
>Thanks for reporting.
>
>I went through the whole set and did some scrubbing of retvals. And that
>edac_dev_register() is already a mess. But cleaning that up is for another day.
>
>So, Shiju, I've pushed a edac-cxl2 branch, please run it again.
Thanks Borislav for fixing this error and changes looks good to me.
Tested fine in the edac-cxl2 branch + following fix for the allmodconfig-x86_64-clang
build error reported in the other thread.
diff --git a/drivers/edac/mem_repair.c b/drivers/edac/mem_repair.c index cbe5a722715d..6f4a9dfcd7da 100755
--- a/drivers/edac/mem_repair.c
+++ b/drivers/edac/mem_repair.c
@@ -322,8 +322,8 @@ static int mem_repair_create_desc(struct device *dev,
return -ENOMEM;
for (i = 0; i < MR_MAX_ATTRS; i++) {
- memcpy(&ctx->mem_repair_dev_attr[i].dev_attr,
- &dev_attr[i], sizeof(dev_attr[i]));
+ memcpy(&ctx->mem_repair_dev_attr[i], &dev_attr[i],
+ sizeof(dev_attr[i]));
ctx->mem_repair_attrs[i] =
&ctx->mem_repair_dev_attr[i].dev_attr.attr;
}
>
>Thx.
>
>Full diff of the changes I've done:
>
>---
>diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c index
>081f77b1f125..16611515ab34 100644
>--- a/drivers/edac/edac_device.c
>+++ b/drivers/edac/edac_device.c
>@@ -581,7 +581,7 @@ static void edac_dev_release(struct device *dev)
> kfree(ctx);
> }
>
>-const struct device_type edac_dev_type = {
>+static const struct device_type edac_dev_type = {
> .name = "edac_dev",
> .release = edac_dev_release,
> };
>@@ -616,8 +616,9 @@ int edac_dev_register(struct device *parent, char
>*name,
> struct edac_dev_feat_ctx *ctx;
> int mem_repair_cnt = 0;
> int attr_gcnt = 0;
>+ int ret = -ENOMEM;
> int scrub_cnt = 0;
>- int ret, feat;
>+ int feat;
>
> if (!parent || !name || !num_features || !ras_features)
> return -EINVAL;
>@@ -646,25 +647,19 @@ int edac_dev_register(struct device *parent, char
>*name,
> return -ENOMEM;
>
> ras_attr_groups = kcalloc(attr_gcnt + 1, sizeof(*ras_attr_groups),
>GFP_KERNEL);
>- if (!ras_attr_groups) {
>- ret = -ENOMEM;
>+ if (!ras_attr_groups)
> goto ctx_free;
>- }
>
> if (scrub_cnt) {
> ctx->scrub = kcalloc(scrub_cnt, sizeof(*ctx->scrub),
>GFP_KERNEL);
>- if (!ctx->scrub) {
>- ret = -ENOMEM;
>+ if (!ctx->scrub)
> goto groups_free;
>- }
> }
>
> if (mem_repair_cnt) {
> ctx->mem_repair = kcalloc(mem_repair_cnt, sizeof(*ctx-
>>mem_repair), GFP_KERNEL);
>- if (!ctx->mem_repair) {
>- ret = -ENOMEM;
>+ if (!ctx->mem_repair)
> goto data_mem_free;
>- }
> }
>
> attr_gcnt = 0;
>@@ -673,9 +668,10 @@ int edac_dev_register(struct device *parent, char
>*name,
> for (feat = 0; feat < num_features; feat++, ras_features++) {
> switch (ras_features->ft_type) {
> case RAS_FEAT_SCRUB:
>- if (!ras_features->scrub_ops ||
>- scrub_cnt != ras_features->instance)
>+ if (!ras_features->scrub_ops || scrub_cnt !=
>ras_features->instance) {
>+ ret = -EINVAL;
> goto data_mem_free;
>+ }
>
> dev_data = &ctx->scrub[scrub_cnt];
> dev_data->instance = scrub_cnt;
>@@ -690,8 +686,10 @@ int edac_dev_register(struct device *parent, char
>*name,
> attr_gcnt++;
> break;
> case RAS_FEAT_ECS:
>- if (!ras_features->ecs_ops)
>+ if (!ras_features->ecs_ops) {
>+ ret = -EINVAL;
> goto data_mem_free;
>+ }
>
> dev_data = &ctx->ecs;
> dev_data->ecs_ops = ras_features->ecs_ops; @@ -705,8
>+703,10 @@ int edac_dev_register(struct device *parent, char *name,
> break;
> case RAS_FEAT_MEM_REPAIR:
> if (!ras_features->mem_repair_ops ||
>- mem_repair_cnt != ras_features->instance)
>+ mem_repair_cnt != ras_features->instance) {
>+ ret = -EINVAL;
> goto data_mem_free;
>+ }
>
> dev_data = &ctx->mem_repair[mem_repair_cnt];
> dev_data->instance = mem_repair_cnt;
>
>--
>Regards/Gruss,
> Boris.
>
>https://people.kernel.org/tglx/notes-about-netiquette
Thank,
Shiju
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [bp:edac-cxl 2/5] drivers/edac/edac_device.c:705 edac_dev_register() error: uninitialized symbol 'ret'.
2025-02-25 18:27 ` Shiju Jose
@ 2025-02-27 10:37 ` Borislav Petkov
2025-02-27 11:57 ` Shiju Jose
0 siblings, 1 reply; 7+ messages in thread
From: Borislav Petkov @ 2025-02-27 10:37 UTC (permalink / raw)
To: Shiju Jose
Cc: Dan Carpenter, oe-kbuild@lists.linux.dev, lkp@intel.com,
oe-kbuild-all@lists.linux.dev, Jonathan Cameron
On Tue, Feb 25, 2025 at 06:27:42PM +0000, Shiju Jose wrote:
> Tested fine in the edac-cxl2 branch + following fix for the allmodconfig-x86_64-clang
> build error reported in the other thread.
>
> diff --git a/drivers/edac/mem_repair.c b/drivers/edac/mem_repair.c index cbe5a722715d..6f4a9dfcd7da 100755
> --- a/drivers/edac/mem_repair.c
> +++ b/drivers/edac/mem_repair.c
> @@ -322,8 +322,8 @@ static int mem_repair_create_desc(struct device *dev,
> return -ENOMEM;
>
> for (i = 0; i < MR_MAX_ATTRS; i++) {
> - memcpy(&ctx->mem_repair_dev_attr[i].dev_attr,
> - &dev_attr[i], sizeof(dev_attr[i]));
> + memcpy(&ctx->mem_repair_dev_attr[i], &dev_attr[i],
> + sizeof(dev_attr[i]));
> ctx->mem_repair_attrs[i] =
> &ctx->mem_repair_dev_attr[i].dev_attr.attr;
> }
>
All fixes merged and branch pushed out.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [bp:edac-cxl 2/5] drivers/edac/edac_device.c:705 edac_dev_register() error: uninitialized symbol 'ret'.
2025-02-27 10:37 ` Borislav Petkov
@ 2025-02-27 11:57 ` Shiju Jose
2025-02-27 12:07 ` Borislav Petkov
0 siblings, 1 reply; 7+ messages in thread
From: Shiju Jose @ 2025-02-27 11:57 UTC (permalink / raw)
To: Borislav Petkov
Cc: Dan Carpenter, oe-kbuild@lists.linux.dev, lkp@intel.com,
oe-kbuild-all@lists.linux.dev, Jonathan Cameron
>-----Original Message-----
>From: Borislav Petkov <bp@alien8.de>
>Sent: 27 February 2025 10:37
>To: Shiju Jose <shiju.jose@huawei.com>
>Cc: Dan Carpenter <dan.carpenter@linaro.org>; oe-kbuild@lists.linux.dev;
>lkp@intel.com; oe-kbuild-all@lists.linux.dev; Jonathan Cameron
><jonathan.cameron@huawei.com>
>Subject: Re: [bp:edac-cxl 2/5] drivers/edac/edac_device.c:705
>edac_dev_register() error: uninitialized symbol 'ret'.
>
>On Tue, Feb 25, 2025 at 06:27:42PM +0000, Shiju Jose wrote:
>> Tested fine in the edac-cxl2 branch + following fix for the
>> allmodconfig-x86_64-clang build error reported in the other thread.
>>
>> diff --git a/drivers/edac/mem_repair.c b/drivers/edac/mem_repair.c
>> index cbe5a722715d..6f4a9dfcd7da 100755
>> --- a/drivers/edac/mem_repair.c
>> +++ b/drivers/edac/mem_repair.c
>> @@ -322,8 +322,8 @@ static int mem_repair_create_desc(struct device *dev,
>> return -ENOMEM;
>>
>> for (i = 0; i < MR_MAX_ATTRS; i++) {
>> - memcpy(&ctx->mem_repair_dev_attr[i].dev_attr,
>> - &dev_attr[i], sizeof(dev_attr[i]));
>> + memcpy(&ctx->mem_repair_dev_attr[i], &dev_attr[i],
>> + sizeof(dev_attr[i]));
>> ctx->mem_repair_attrs[i] =
>> &ctx->mem_repair_dev_attr[i].dev_attr.attr;
>> }
>>
>
>All fixes merged and branch pushed out.
Thanks Boris. Looks like the above fix in the drivers/edac/mem_repair.c is not yet in the
edac-cxl2 branch.
Thanks,
Shiju
>
>Thx.
>
>--
>Regards/Gruss,
> Boris.
>
>https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [bp:edac-cxl 2/5] drivers/edac/edac_device.c:705 edac_dev_register() error: uninitialized symbol 'ret'.
2025-02-27 11:57 ` Shiju Jose
@ 2025-02-27 12:07 ` Borislav Petkov
0 siblings, 0 replies; 7+ messages in thread
From: Borislav Petkov @ 2025-02-27 12:07 UTC (permalink / raw)
To: Shiju Jose
Cc: Dan Carpenter, oe-kbuild@lists.linux.dev, lkp@intel.com,
oe-kbuild-all@lists.linux.dev, Jonathan Cameron
On Thu, Feb 27, 2025 at 11:57:40AM +0000, Shiju Jose wrote:
> Thanks Boris. Looks like the above fix in the drivers/edac/mem_repair.c is
> not yet in the edac-cxl2 branch.
https://web.git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git/log/?h=edac-cxl
This is the official RAS repo of Tony and me where stuff gets staged.
The URLs I was giving you were my repo which is used only for testing out
things.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-02-27 12:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-25 7:46 [bp:edac-cxl 2/5] drivers/edac/edac_device.c:705 edac_dev_register() error: uninitialized symbol 'ret' Dan Carpenter
2025-02-25 14:54 ` Borislav Petkov
2025-02-25 18:27 ` Shiju Jose
2025-02-27 10:37 ` Borislav Petkov
2025-02-27 11:57 ` Shiju Jose
2025-02-27 12:07 ` Borislav Petkov
-- strict thread matches above, loose matches on Subject: below --
2025-02-25 2:35 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.