All of lore.kernel.org
 help / color / mirror / Atom feed
* [dinguyen:socfpga_fcs_v1 1/4] drivers/firmware/stratix10-svc.c:1335:13: warning: variable 'pmem' is uninitialized when used here
@ 2026-06-26 20:26 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-06-26 20:26 UTC (permalink / raw)
  To: Wang, Hang Suan; +Cc: llvm, oe-kbuild-all, Dinh Nguyen

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux.git socfpga_fcs_v1
head:   2de200789f740e5728f4247447495d1f1035a4ec
commit: a662668d29291c2ceafbd7e8067b4e3cd737c840 [1/4] firmware: stratix10-svc: add FCS crypto-service commands for Agilex5
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20260627/202606270412.GSfC6eHB-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 6cc609bb250b21b47fc7d394b4019101e9983597)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260627/202606270412.GSfC6eHB-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/202606270412.GSfC6eHB-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/firmware/stratix10-svc.c:1335:13: warning: variable 'pmem' is uninitialized when used here [-Wuninitialized]
    1335 |                 args.a5 = pmem->paddr;
         |                           ^~~~
   drivers/firmware/stratix10-svc.c:1279:37: note: initialize the variable 'pmem' to silence this warning
    1279 |         struct stratix10_svc_data_mem *pmem;
         |                                            ^
         |                                             = NULL
   1 warning generated.


vim +/pmem +1335 drivers/firmware/stratix10-svc.c

  1244	
  1245	/**
  1246	 * stratix10_svc_async_send - Send an asynchronous message to the
  1247	 *                            Stratix10 service
  1248	 * @chan: Pointer to the service channel structure
  1249	 * @msg: Pointer to the message to be sent
  1250	 * @handler: Pointer to the handler for the asynchronous message
  1251	 *           used by caller for later reference.
  1252	 * @cb: Callback function to be called upon completion
  1253	 * @cb_arg: Argument to be passed to the callback function
  1254	 *
  1255	 * This function sends an asynchronous message to the SDM mailbox in
  1256	 * EL3 secure firmware. It performs various checks and setups,
  1257	 * including allocating a job ID, setting up the transaction ID and
  1258	 * packaging it to El3 firmware. The function handles different
  1259	 * commands by setting up the appropriate arguments for the SMC call.
  1260	 * If the SMC call is successful, the handler is set up and the
  1261	 * function returns 0. If the SMC call fails, appropriate error
  1262	 * handling is performed along with cleanup of resources.
  1263	 *
  1264	 * Return: 0 on success, -EINVAL for invalid argument, -ENOMEM if
  1265	 * memory is not available, -EAGAIN if EL3 firmware is busy, -EBADF
  1266	 * if the message is rejected by EL3 firmware and -EIO on other
  1267	 * errors from EL3 firmware.
  1268	 */
  1269	int stratix10_svc_async_send(struct stratix10_svc_chan *chan, void *msg,
  1270				     void **handler, async_callback_t cb, void *cb_arg)
  1271	{
  1272		struct arm_smccc_1_2_regs args = { 0 }, res = { 0 };
  1273		struct stratix10_svc_async_handler *handle = NULL;
  1274		struct stratix10_svc_client_msg *p_msg =
  1275			(struct stratix10_svc_client_msg *)msg;
  1276		struct stratix10_svc_controller *ctrl;
  1277		struct stratix10_async_ctrl *actrl;
  1278		struct stratix10_async_chan *achan;
  1279		struct stratix10_svc_data_mem *pmem;
  1280		int ret = 0;
  1281	
  1282		if (!chan || !msg || !handler)
  1283			return -EINVAL;
  1284	
  1285		achan = chan->async_chan;
  1286		ctrl = chan->ctrl;
  1287		actrl = &ctrl->actrl;
  1288	
  1289		if (!actrl->initialized) {
  1290			dev_err(ctrl->dev, "Async controller not initialized\n");
  1291			return -EINVAL;
  1292		}
  1293	
  1294		if (!achan) {
  1295			dev_err(ctrl->dev, "Async channel not allocated\n");
  1296			return -EINVAL;
  1297		}
  1298	
  1299		handle = kzalloc(sizeof(*handle), GFP_KERNEL);
  1300		if (!handle)
  1301			return -ENOMEM;
  1302	
  1303		ret = ida_alloc_max(&achan->job_id_pool, MAX_SDM_JOB_IDS,
  1304				    GFP_KERNEL);
  1305		if (ret < 0) {
  1306			dev_err(ctrl->dev, "Failed to allocate job id\n");
  1307			kfree(handle);
  1308			return -ENOMEM;
  1309		}
  1310	
  1311		handle->transaction_id =
  1312			STRATIX10_SET_TRANSACTIONID(achan->async_client_id, ret);
  1313		handle->cb = cb;
  1314		handle->msg = p_msg;
  1315		handle->cb_arg = cb_arg;
  1316		handle->achan = achan;
  1317	
  1318		/*set the transaction jobid in args.a1*/
  1319		args.a1 =
  1320			STRATIX10_SIP_SMC_SET_TRANSACTIONID_X1(handle->transaction_id);
  1321	
  1322		switch (p_msg->command) {
  1323		case COMMAND_FCS_CRYPTO_OPEN_SESSION:
  1324			args.a0 = INTEL_SIP_SMC_ASYNC_FCS_OPEN_CS_SESSION;
  1325			break;
  1326		case COMMAND_FCS_CRYPTO_CLOSE_SESSION:
  1327			args.a0 = INTEL_SIP_SMC_ASYNC_FCS_CLOSE_CS_SESSION;
  1328			args.a2 = p_msg->arg[0];
  1329			break;
  1330		case COMMAND_FCS_SDOS_DATA_EXT:
  1331			args.a0 = INTEL_SIP_SMC_ASYNC_FCS_CRYPTION_EXT;
  1332			args.a2 = p_msg->arg[0];
  1333			args.a3 = p_msg->arg[1];
  1334			args.a4 = p_msg->arg[2];
> 1335			args.a5 = pmem->paddr;
  1336			args.a6 = p_msg->payload_length;
  1337			args.a7 = pmem->paddr;
  1338			args.a8 = p_msg->payload_length_output;
  1339			args.a9 = p_msg->arg[3];
  1340			args.a10 = pmem->paddr;
  1341			args.a11 = pmem->paddr;
  1342			break;
  1343		case COMMAND_RSU_GET_SPT_TABLE:
  1344			args.a0 = INTEL_SIP_SMC_ASYNC_RSU_GET_SPT;
  1345			break;
  1346		case COMMAND_RSU_STATUS:
  1347			args.a0 = INTEL_SIP_SMC_ASYNC_RSU_GET_ERROR_STATUS;
  1348			break;
  1349		case COMMAND_RSU_NOTIFY:
  1350			args.a0 = INTEL_SIP_SMC_ASYNC_RSU_NOTIFY;
  1351			args.a2 = p_msg->arg[0];
  1352			break;
  1353		default:
  1354			dev_err(ctrl->dev, "Invalid command ,%d\n", p_msg->command);
  1355			ret = -EINVAL;
  1356			goto deallocate_id;
  1357		}
  1358	
  1359		/**
  1360		 * There is a chance that during the execution of async_send()
  1361		 * in one core, an interrupt might be received in another core;
  1362		 * to mitigate this we are adding the handle to the DB and then
  1363		 * send the smc call. If the smc call is rejected or busy then
  1364		 * we will deallocate the handle for the client to retry again.
  1365		 */
  1366		scoped_guard(spinlock_bh, &actrl->trx_list_lock) {
  1367			hash_add(actrl->trx_list, &handle->next,
  1368				 handle->transaction_id);
  1369		}
  1370	
  1371		actrl->invoke_fn(actrl, &args, &res);
  1372	
  1373		switch (res.a0) {
  1374		case INTEL_SIP_SMC_STATUS_OK:
  1375			dev_dbg(ctrl->dev,
  1376				"Async message sent with transaction_id 0x%02x\n",
  1377				handle->transaction_id);
  1378			*handler = handle;
  1379			return 0;
  1380		case INTEL_SIP_SMC_STATUS_BUSY:
  1381			dev_warn(ctrl->dev, "Mailbox is busy, try after some time\n");
  1382			ret = -EAGAIN;
  1383			break;
  1384		case INTEL_SIP_SMC_STATUS_REJECTED:
  1385			dev_err(ctrl->dev, "Async message rejected\n");
  1386			ret = -EBADF;
  1387			break;
  1388		default:
  1389			dev_err(ctrl->dev,
  1390				"Failed to send async message ,got status as %ld\n",
  1391				res.a0);
  1392			ret = -EIO;
  1393		}
  1394	
  1395		scoped_guard(spinlock_bh, &actrl->trx_list_lock) {
  1396			hash_del(&handle->next);
  1397		}
  1398	
  1399	deallocate_id:
  1400		ida_free(&achan->job_id_pool,
  1401			 STRATIX10_GET_JOBID(handle->transaction_id));
  1402		kfree(handle);
  1403		return ret;
  1404	}
  1405	EXPORT_SYMBOL_GPL(stratix10_svc_async_send);
  1406	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-26 20:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-26 20:26 [dinguyen:socfpga_fcs_v1 1/4] drivers/firmware/stratix10-svc.c:1335:13: warning: variable 'pmem' is uninitialized when used here 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.