All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Yuanjun Gong <ruc_gongyuanjun@163.com>, tyreld@linux.ibm.com
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	christophe.leroy@csgroup.eu, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au,
	npiggin@gmail.com, Yuanjun Gong <ruc_gongyuanjun@163.com>
Subject: Re: [PATCH v2 1/1] powerpc: fix a memory leak
Date: Wed, 8 Nov 2023 17:24:04 +0800	[thread overview]
Message-ID: <202311081645.j68Cla77-lkp@intel.com> (raw)
In-Reply-To: <20230915020559.3396566-1-ruc_gongyuanjun@163.com>

Hi Yuanjun,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.6 next-20231108]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yuanjun-Gong/powerpc-fix-a-memory-leak/20230915-100832
base:   linus/master
patch link:    https://lore.kernel.org/r/20230915020559.3396566-1-ruc_gongyuanjun%40163.com
patch subject: [PATCH v2 1/1] powerpc: fix a memory leak
config: powerpc-allyesconfig (https://download.01.org/0day-ci/archive/20231108/202311081645.j68Cla77-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231108/202311081645.j68Cla77-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/202311081645.j68Cla77-lkp@intel.com/

All errors (new ones prefixed by >>):

>> arch/powerpc/platforms/powernv/vas.c:105:15: error: expected ';' after expression
     105 |                 rc = -ENODEV
         |                             ^
         |                             ;
   1 error generated.


vim +105 arch/powerpc/platforms/powernv/vas.c

    49	
    50	static int init_vas_instance(struct platform_device *pdev)
    51	{
    52		struct device_node *dn = pdev->dev.of_node;
    53		struct vas_instance *vinst;
    54		struct xive_irq_data *xd;
    55		uint32_t chipid, hwirq;
    56		struct resource *res;
    57		int rc, cpu, vasid;
    58	
    59		rc = of_property_read_u32(dn, "ibm,vas-id", &vasid);
    60		if (rc) {
    61			pr_err("No ibm,vas-id property for %s?\n", pdev->name);
    62			return -ENODEV;
    63		}
    64	
    65		rc = of_property_read_u32(dn, "ibm,chip-id", &chipid);
    66		if (rc) {
    67			pr_err("No ibm,chip-id property for %s?\n", pdev->name);
    68			return -ENODEV;
    69		}
    70	
    71		if (pdev->num_resources != 4) {
    72			pr_err("Unexpected DT configuration for [%s, %d]\n",
    73					pdev->name, vasid);
    74			return -ENODEV;
    75		}
    76	
    77		vinst = kzalloc(sizeof(*vinst), GFP_KERNEL);
    78		if (!vinst)
    79			return -ENOMEM;
    80	
    81		vinst->name = kasprintf(GFP_KERNEL, "vas-%d", vasid);
    82		if (!vinst->name) {
    83			kfree(vinst);
    84			return -ENOMEM;
    85		}
    86	
    87		INIT_LIST_HEAD(&vinst->node);
    88		ida_init(&vinst->ida);
    89		mutex_init(&vinst->mutex);
    90		vinst->vas_id = vasid;
    91		vinst->pdev = pdev;
    92	
    93		res = &pdev->resource[0];
    94		vinst->hvwc_bar_start = res->start;
    95	
    96		res = &pdev->resource[1];
    97		vinst->uwc_bar_start = res->start;
    98	
    99		res = &pdev->resource[2];
   100		vinst->paste_base_addr = res->start;
   101	
   102		res = &pdev->resource[3];
   103		if (res->end > 62) {
   104			pr_err("Bad 'paste_win_id_shift' in DT, %llx\n", res->end);
 > 105			rc = -ENODEV
   106			goto free_vinst;
   107		}
   108	
   109		vinst->paste_win_id_shift = 63 - res->end;
   110	
   111		hwirq = xive_native_alloc_irq_on_chip(chipid);
   112		if (!hwirq) {
   113			pr_err("Inst%d: Unable to allocate global irq for chip %d\n",
   114					vinst->vas_id, chipid);
   115			rc = -ENOENT;
   116			goto free_vinst;
   117		}
   118	
   119		vinst->virq = irq_create_mapping(NULL, hwirq);
   120		if (!vinst->virq) {
   121			pr_err("Inst%d: Unable to map global irq %d\n",
   122					vinst->vas_id, hwirq);
   123			rc = -EINVAL;
   124			goto free_vinst;
   125		}
   126	
   127		xd = irq_get_handler_data(vinst->virq);
   128		if (!xd) {
   129			pr_err("Inst%d: Invalid virq %d\n",
   130					vinst->vas_id, vinst->virq);
   131			rc = -EINVAL;
   132			goto free_vinst;
   133		}
   134	
   135		vinst->irq_port = xd->trig_page;
   136		pr_devel("Initialized instance [%s, %d] paste_base 0x%llx paste_win_id_shift 0x%llx IRQ %d Port 0x%llx\n",
   137				pdev->name, vasid, vinst->paste_base_addr,
   138				vinst->paste_win_id_shift, vinst->virq,
   139				vinst->irq_port);
   140	
   141		for_each_possible_cpu(cpu) {
   142			if (cpu_to_chip_id(cpu) == of_get_ibm_chip_id(dn))
   143				per_cpu(cpu_vas_id, cpu) = vasid;
   144		}
   145	
   146		mutex_lock(&vas_mutex);
   147		list_add(&vinst->node, &vas_instances);
   148		mutex_unlock(&vas_mutex);
   149	
   150		spin_lock_init(&vinst->fault_lock);
   151		/*
   152		 * IRQ and fault handling setup is needed only for user space
   153		 * send windows.
   154		 */
   155		if (vinst->virq) {
   156			rc = vas_irq_fault_window_setup(vinst);
   157			/*
   158			 * Fault window is used only for user space send windows.
   159			 * So if vinst->virq is NULL, tx_win_open returns -ENODEV
   160			 * for user space.
   161			 */
   162			if (rc)
   163				vinst->virq = 0;
   164		}
   165	
   166		vas_instance_init_dbgdir(vinst);
   167	
   168		dev_set_drvdata(&pdev->dev, vinst);
   169	
   170		return 0;
   171	
   172	free_vinst:
   173		kfree(vinst->name);
   174		kfree(vinst);
   175		return rc;
   176	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Yuanjun Gong <ruc_gongyuanjun@163.com>, tyreld@linux.ibm.com
Cc: llvm@lists.linux.dev, linux-kernel@vger.kernel.org,
	Yuanjun Gong <ruc_gongyuanjun@163.com>,
	npiggin@gmail.com, oe-kbuild-all@lists.linux.dev,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2 1/1] powerpc: fix a memory leak
Date: Wed, 8 Nov 2023 17:24:04 +0800	[thread overview]
Message-ID: <202311081645.j68Cla77-lkp@intel.com> (raw)
In-Reply-To: <20230915020559.3396566-1-ruc_gongyuanjun@163.com>

Hi Yuanjun,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.6 next-20231108]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yuanjun-Gong/powerpc-fix-a-memory-leak/20230915-100832
base:   linus/master
patch link:    https://lore.kernel.org/r/20230915020559.3396566-1-ruc_gongyuanjun%40163.com
patch subject: [PATCH v2 1/1] powerpc: fix a memory leak
config: powerpc-allyesconfig (https://download.01.org/0day-ci/archive/20231108/202311081645.j68Cla77-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231108/202311081645.j68Cla77-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/202311081645.j68Cla77-lkp@intel.com/

All errors (new ones prefixed by >>):

>> arch/powerpc/platforms/powernv/vas.c:105:15: error: expected ';' after expression
     105 |                 rc = -ENODEV
         |                             ^
         |                             ;
   1 error generated.


vim +105 arch/powerpc/platforms/powernv/vas.c

    49	
    50	static int init_vas_instance(struct platform_device *pdev)
    51	{
    52		struct device_node *dn = pdev->dev.of_node;
    53		struct vas_instance *vinst;
    54		struct xive_irq_data *xd;
    55		uint32_t chipid, hwirq;
    56		struct resource *res;
    57		int rc, cpu, vasid;
    58	
    59		rc = of_property_read_u32(dn, "ibm,vas-id", &vasid);
    60		if (rc) {
    61			pr_err("No ibm,vas-id property for %s?\n", pdev->name);
    62			return -ENODEV;
    63		}
    64	
    65		rc = of_property_read_u32(dn, "ibm,chip-id", &chipid);
    66		if (rc) {
    67			pr_err("No ibm,chip-id property for %s?\n", pdev->name);
    68			return -ENODEV;
    69		}
    70	
    71		if (pdev->num_resources != 4) {
    72			pr_err("Unexpected DT configuration for [%s, %d]\n",
    73					pdev->name, vasid);
    74			return -ENODEV;
    75		}
    76	
    77		vinst = kzalloc(sizeof(*vinst), GFP_KERNEL);
    78		if (!vinst)
    79			return -ENOMEM;
    80	
    81		vinst->name = kasprintf(GFP_KERNEL, "vas-%d", vasid);
    82		if (!vinst->name) {
    83			kfree(vinst);
    84			return -ENOMEM;
    85		}
    86	
    87		INIT_LIST_HEAD(&vinst->node);
    88		ida_init(&vinst->ida);
    89		mutex_init(&vinst->mutex);
    90		vinst->vas_id = vasid;
    91		vinst->pdev = pdev;
    92	
    93		res = &pdev->resource[0];
    94		vinst->hvwc_bar_start = res->start;
    95	
    96		res = &pdev->resource[1];
    97		vinst->uwc_bar_start = res->start;
    98	
    99		res = &pdev->resource[2];
   100		vinst->paste_base_addr = res->start;
   101	
   102		res = &pdev->resource[3];
   103		if (res->end > 62) {
   104			pr_err("Bad 'paste_win_id_shift' in DT, %llx\n", res->end);
 > 105			rc = -ENODEV
   106			goto free_vinst;
   107		}
   108	
   109		vinst->paste_win_id_shift = 63 - res->end;
   110	
   111		hwirq = xive_native_alloc_irq_on_chip(chipid);
   112		if (!hwirq) {
   113			pr_err("Inst%d: Unable to allocate global irq for chip %d\n",
   114					vinst->vas_id, chipid);
   115			rc = -ENOENT;
   116			goto free_vinst;
   117		}
   118	
   119		vinst->virq = irq_create_mapping(NULL, hwirq);
   120		if (!vinst->virq) {
   121			pr_err("Inst%d: Unable to map global irq %d\n",
   122					vinst->vas_id, hwirq);
   123			rc = -EINVAL;
   124			goto free_vinst;
   125		}
   126	
   127		xd = irq_get_handler_data(vinst->virq);
   128		if (!xd) {
   129			pr_err("Inst%d: Invalid virq %d\n",
   130					vinst->vas_id, vinst->virq);
   131			rc = -EINVAL;
   132			goto free_vinst;
   133		}
   134	
   135		vinst->irq_port = xd->trig_page;
   136		pr_devel("Initialized instance [%s, %d] paste_base 0x%llx paste_win_id_shift 0x%llx IRQ %d Port 0x%llx\n",
   137				pdev->name, vasid, vinst->paste_base_addr,
   138				vinst->paste_win_id_shift, vinst->virq,
   139				vinst->irq_port);
   140	
   141		for_each_possible_cpu(cpu) {
   142			if (cpu_to_chip_id(cpu) == of_get_ibm_chip_id(dn))
   143				per_cpu(cpu_vas_id, cpu) = vasid;
   144		}
   145	
   146		mutex_lock(&vas_mutex);
   147		list_add(&vinst->node, &vas_instances);
   148		mutex_unlock(&vas_mutex);
   149	
   150		spin_lock_init(&vinst->fault_lock);
   151		/*
   152		 * IRQ and fault handling setup is needed only for user space
   153		 * send windows.
   154		 */
   155		if (vinst->virq) {
   156			rc = vas_irq_fault_window_setup(vinst);
   157			/*
   158			 * Fault window is used only for user space send windows.
   159			 * So if vinst->virq is NULL, tx_win_open returns -ENODEV
   160			 * for user space.
   161			 */
   162			if (rc)
   163				vinst->virq = 0;
   164		}
   165	
   166		vas_instance_init_dbgdir(vinst);
   167	
   168		dev_set_drvdata(&pdev->dev, vinst);
   169	
   170		return 0;
   171	
   172	free_vinst:
   173		kfree(vinst->name);
   174		kfree(vinst);
   175		return rc;
   176	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  parent reply	other threads:[~2023-11-08  9:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14  9:46 [PATCH 1/1] powerpc: fix a memory leak Yuanjun Gong
2023-09-14 16:10 ` Tyrel Datwyler
2023-09-15  0:50   ` Michael Ellerman
2023-09-15  2:05   ` [PATCH v2 " Yuanjun Gong
2023-09-15  2:05     ` Yuanjun Gong
2023-09-24  1:18     ` kernel test robot
2023-09-24  1:18       ` kernel test robot
2023-11-08  9:24     ` kernel test robot [this message]
2023-11-08  9:24       ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202311081645.j68Cla77-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=llvm@lists.linux.dev \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=ruc_gongyuanjun@163.com \
    --cc=tyreld@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.