linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Tanmay Shah <tanmay.shah@amd.com>,
	andersson@kernel.org, mathieu.poirier@linaro.org,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	conor+dt@kernel.org, michal.simek@amd.com, ben.levinsky@amd.com
Cc: oe-kbuild-all@lists.linux.dev, linux-remoteproc@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 4/4] remoteproc: zynqmp: parse TCM from device tree
Date: Thu, 19 Oct 2023 19:03:47 +0800	[thread overview]
Message-ID: <202310191806.NjLsejwM-lkp@intel.com> (raw)
In-Reply-To: <20231013042229.3954527-5-tanmay.shah@amd.com>

Hi Tanmay,

kernel test robot noticed the following build warnings:

[auto build test WARNING on a7d272979d3a89b117ca2c547dc8a465c4f28635]

url:    https://github.com/intel-lab-lkp/linux/commits/Tanmay-Shah/dt-bindings-remoteproc-add-Tightly-Coupled-Memory-TCM-bindings/20231017-120805
base:   a7d272979d3a89b117ca2c547dc8a465c4f28635
patch link:    https://lore.kernel.org/r/20231013042229.3954527-5-tanmay.shah%40amd.com
patch subject: [PATCH v6 4/4] remoteproc: zynqmp: parse TCM from device tree
config: arm64-randconfig-002-20231019 (https://download.01.org/0day-ci/archive/20231019/202310191806.NjLsejwM-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231019/202310191806.NjLsejwM-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/202310191806.NjLsejwM-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/remoteproc/xlnx_r5_remoteproc.c: In function 'zynqmp_r5_get_tcm_node_from_dt':
>> drivers/remoteproc/xlnx_r5_remoteproc.c:1162:28: warning: array subscript 'struct mem_bank_data[0]' is partly outside array bounds of 'unsigned char[8]' [-Warray-bounds=]
    1162 |                         tcm->da = (u32)abs_addr;
         |                            ^~
   In file included from include/linux/dma-mapping.h:8,
                    from drivers/remoteproc/xlnx_r5_remoteproc.c:8:
   In function 'devm_kzalloc',
       inlined from 'zynqmp_r5_get_tcm_node_from_dt' at drivers/remoteproc/xlnx_r5_remoteproc.c:1143:10:
   include/linux/device.h:314:16: note: object of size 8 allocated by 'devm_kmalloc'
     314 |         return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/remoteproc/xlnx_r5_remoteproc.c: In function 'zynqmp_r5_get_tcm_node_from_dt':
   drivers/remoteproc/xlnx_r5_remoteproc.c:1163:28: warning: array subscript 'struct mem_bank_data[0]' is partly outside array bounds of 'unsigned char[8]' [-Warray-bounds=]
    1163 |                         tcm->size = (u32)size;
         |                            ^~
   In function 'devm_kzalloc',
       inlined from 'zynqmp_r5_get_tcm_node_from_dt' at drivers/remoteproc/xlnx_r5_remoteproc.c:1143:10:
   include/linux/device.h:314:16: note: object of size 8 allocated by 'devm_kmalloc'
     314 |         return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/remoteproc/xlnx_r5_remoteproc.c: In function 'zynqmp_r5_get_tcm_node_from_dt':
   drivers/remoteproc/xlnx_r5_remoteproc.c:1172:28: warning: array subscript 'struct mem_bank_data[0]' is partly outside array bounds of 'unsigned char[8]' [-Warray-bounds=]
    1172 |                         tcm->addr = (u32)res->start;
         |                            ^~
   In function 'devm_kzalloc',
       inlined from 'zynqmp_r5_get_tcm_node_from_dt' at drivers/remoteproc/xlnx_r5_remoteproc.c:1143:10:
   include/linux/device.h:314:16: note: object of size 8 allocated by 'devm_kmalloc'
     314 |         return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/remoteproc/xlnx_r5_remoteproc.c: In function 'zynqmp_r5_get_tcm_node_from_dt':
   drivers/remoteproc/xlnx_r5_remoteproc.c:1173:28: warning: array subscript 'struct mem_bank_data[0]' is partly outside array bounds of 'unsigned char[8]' [-Warray-bounds=]
    1173 |                         tcm->bank_name = (char *)res->name;
         |                            ^~
   In function 'devm_kzalloc',
       inlined from 'zynqmp_r5_get_tcm_node_from_dt' at drivers/remoteproc/xlnx_r5_remoteproc.c:1143:10:
   include/linux/device.h:314:16: note: object of size 8 allocated by 'devm_kmalloc'
     314 |         return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/device.h:17:
   drivers/remoteproc/xlnx_r5_remoteproc.c: In function 'zynqmp_r5_get_tcm_node_from_dt':
   drivers/remoteproc/xlnx_r5_remoteproc.c:1174:74: warning: array subscript 'struct mem_bank_data[0]' is partly outside array bounds of 'unsigned char[8]' [-Warray-bounds=]
    1174 |                         res = devm_request_mem_region(dev, tcm->addr, tcm->size,
         |                                                                          ^~
   include/linux/ioport.h:306:63: note: in definition of macro 'devm_request_mem_region'
     306 |         __devm_request_region(dev, &iomem_resource, (start), (n), (name))
         |                                                               ^
   In function 'devm_kzalloc',
       inlined from 'zynqmp_r5_get_tcm_node_from_dt' at drivers/remoteproc/xlnx_r5_remoteproc.c:1143:10:
   include/linux/device.h:314:16: note: object of size 8 allocated by 'devm_kmalloc'
     314 |         return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +1162 drivers/remoteproc/xlnx_r5_remoteproc.c

  1108	
  1109	static int zynqmp_r5_get_tcm_node_from_dt(struct zynqmp_r5_cluster *cluster)
  1110	{
  1111		struct zynqmp_r5_core *r5_core;
  1112		int i, j, tcm_bank_count, ret;
  1113		struct platform_device *cpdev;
  1114		struct mem_bank_data *tcm;
  1115		struct device_node *np;
  1116		struct resource *res;
  1117		u64 abs_addr, size;
  1118		struct device *dev;
  1119	
  1120		for (i = 0; i < cluster->core_count; i++) {
  1121			r5_core = cluster->r5_cores[i];
  1122			dev = r5_core->dev;
  1123			np = dev_of_node(dev);
  1124	
  1125			/* we have address cell 2 and size cell as 2 */
  1126			ret = of_property_count_elems_of_size(np, "reg",
  1127							      4 * sizeof(u32));
  1128			if (ret <= 0) {
  1129				dev_err(dev, "can't get reg property err %d\n", ret);
  1130				return -EINVAL;
  1131			}
  1132	
  1133			tcm_bank_count = ret;
  1134	
  1135			r5_core->tcm_banks = devm_kcalloc(dev, tcm_bank_count,
  1136							  sizeof(struct mem_bank_data *),
  1137							  GFP_KERNEL);
  1138			if (!r5_core->tcm_banks)
  1139				ret = -ENOMEM;
  1140	
  1141			r5_core->tcm_bank_count = tcm_bank_count;
  1142			for (j = 0; j < tcm_bank_count; j++) {
  1143				tcm = devm_kzalloc(dev, sizeof(struct mem_bank_data *),
  1144						   GFP_KERNEL);
  1145				if (!tcm)
  1146					return -ENOMEM;
  1147	
  1148				r5_core->tcm_banks[j] = tcm;
  1149	
  1150				/* get tcm address without translation */
  1151				ret = of_property_read_reg(np, j, &abs_addr, &size);
  1152				if (ret) {
  1153					dev_err(dev, "failed to get reg property\n");
  1154					return ret;
  1155				}
  1156	
  1157				/*
  1158				 * remote processor can address only 32 bits
  1159				 * so convert 64-bits into 32-bits. This will discard
  1160				 * any unwanted upper 32-bits.
  1161				 */
> 1162				tcm->da = (u32)abs_addr;
  1163				tcm->size = (u32)size;
  1164	
  1165				cpdev = to_platform_device(dev);
  1166				res = platform_get_resource(cpdev, IORESOURCE_MEM, j);
  1167				if (!res) {
  1168					dev_err(dev, "failed to get tcm resource\n");
  1169					return -EINVAL;
  1170				}
  1171	
  1172				tcm->addr = (u32)res->start;
  1173				tcm->bank_name = (char *)res->name;
  1174				res = devm_request_mem_region(dev, tcm->addr, tcm->size,
  1175							      tcm->bank_name);
  1176				if (!res) {
  1177					dev_err(dev, "failed to request tcm resource\n");
  1178					return -EINVAL;
  1179				}
  1180			}
  1181		}
  1182	
  1183		return 0;
  1184	}
  1185	

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2023-10-19 11:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-13  4:22 [PATCH v6 0/4] add zynqmp TCM bindings Tanmay Shah
2023-10-13  4:22 ` [PATCH v6 1/4] dt-bindings: remoteproc: add Tightly Coupled Memory (TCM) bindings Tanmay Shah
2023-10-13  4:22 ` [PATCH v6 2/4] dts: zynqmp: add properties for TCM in remoteproc Tanmay Shah
2023-10-13  4:22 ` [PATCH v6 3/4] remoteproc: zynqmp: add pm domains support Tanmay Shah
2023-10-18 17:38   ` Mathieu Poirier
2023-10-30 16:09     ` Tanmay Shah
2023-10-13  4:22 ` [PATCH v6 4/4] remoteproc: zynqmp: parse TCM from device tree Tanmay Shah
2023-10-19 11:03   ` kernel test robot [this message]

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=202310191806.NjLsejwM-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=andersson@kernel.org \
    --cc=ben.levinsky@amd.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=michal.simek@amd.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=robh+dt@kernel.org \
    --cc=tanmay.shah@amd.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 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).