[PATCH] firmware: stratix10-rsu: correctly report unsupported DCMF commands

Beniamin Sandu posted 1 patch 2 years ago
There is a newer version of this series
drivers/firmware/stratix10-rsu.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
[PATCH] firmware: stratix10-rsu: correctly report unsupported DCMF commands
Posted by Beniamin Sandu 2 years ago
On older firmware that doesn't support DCMF commands, driver will
otherwise report those as failed to read, instead of unsupported.

Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
---
 drivers/firmware/stratix10-rsu.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/stratix10-rsu.c b/drivers/firmware/stratix10-rsu.c
index 4f7a7abada48..291a14db61c2 100644
--- a/drivers/firmware/stratix10-rsu.c
+++ b/drivers/firmware/stratix10-rsu.c
@@ -235,7 +235,9 @@ static void rsu_dcmf_version_callback(struct stratix10_svc_client *client,
 		priv->dcmf_version.dcmf1 = FIELD_GET(RSU_DCMF1_MASK, *value1);
 		priv->dcmf_version.dcmf2 = FIELD_GET(RSU_DCMF2_MASK, *value2);
 		priv->dcmf_version.dcmf3 = FIELD_GET(RSU_DCMF3_MASK, *value2);
-	} else
+	} else if (data->status == BIT(SVC_STATUS_NO_SUPPORT))
+		dev_warn(client->dev, "Secure FW doesn't support DCMF version.")
+	else
 		dev_err(client->dev, "failed to get DCMF version\n");
 
 	complete(&priv->completion);
@@ -264,7 +266,9 @@ static void rsu_dcmf_status_callback(struct stratix10_svc_client *client,
 						    *value);
 		priv->dcmf_status.dcmf3 = FIELD_GET(RSU_DCMF3_STATUS_MASK,
 						    *value);
-	} else
+	} else if (data->status == BIT(SVC_STATUS_NO_SUPPORT))
+		dev_warn(client->dev, "Secure FW doesn't support DCMF status.")
+	else
 		dev_err(client->dev, "failed to get DCMF status\n");
 
 	complete(&priv->completion);
-- 
2.34.1
Re: [PATCH] firmware: stratix10-rsu: correctly report unsupported DCMF commands
Posted by kernel test robot 2 years ago
Hi Beniamin,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.7-rc3 next-20231130]
[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/Beniamin-Sandu/firmware-stratix10-rsu-correctly-report-unsupported-DCMF-commands/20231130-055016
base:   linus/master
patch link:    https://lore.kernel.org/r/20231129190336.247674-1-beniaminsandu%40gmail.com
patch subject: [PATCH] firmware: stratix10-rsu: correctly report unsupported DCMF commands
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20231130/202311301536.gQXR41jR-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/20231130/202311301536.gQXR41jR-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/202311301536.gQXR41jR-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/firmware/stratix10-rsu.c: In function 'rsu_dcmf_version_callback':
>> drivers/firmware/stratix10-rsu.c:240:9: error: expected ';' before 'else'
     240 |         else
         |         ^~~~
   drivers/firmware/stratix10-rsu.c: In function 'rsu_dcmf_status_callback':
   drivers/firmware/stratix10-rsu.c:271:9: error: expected ';' before 'else'
     271 |         else
         |         ^~~~


vim +240 drivers/firmware/stratix10-rsu.c

   217	
   218	/**
   219	 * rsu_dcmf_version_callback() - Callback from Intel service layer for getting
   220	 * the DCMF version
   221	 * @client: pointer to client
   222	 * @data: pointer to callback data structure
   223	 *
   224	 * Callback from Intel service layer for DCMF version number
   225	 */
   226	static void rsu_dcmf_version_callback(struct stratix10_svc_client *client,
   227					      struct stratix10_svc_cb_data *data)
   228	{
   229		struct stratix10_rsu_priv *priv = client->priv;
   230		unsigned long long *value1 = (unsigned long long *)data->kaddr1;
   231		unsigned long long *value2 = (unsigned long long *)data->kaddr2;
   232	
   233		if (data->status == BIT(SVC_STATUS_OK)) {
   234			priv->dcmf_version.dcmf0 = FIELD_GET(RSU_DCMF0_MASK, *value1);
   235			priv->dcmf_version.dcmf1 = FIELD_GET(RSU_DCMF1_MASK, *value1);
   236			priv->dcmf_version.dcmf2 = FIELD_GET(RSU_DCMF2_MASK, *value2);
   237			priv->dcmf_version.dcmf3 = FIELD_GET(RSU_DCMF3_MASK, *value2);
   238		} else if (data->status == BIT(SVC_STATUS_NO_SUPPORT))
   239			dev_warn(client->dev, "Secure FW doesn't support DCMF version.")
 > 240		else
   241			dev_err(client->dev, "failed to get DCMF version\n");
   242	
   243		complete(&priv->completion);
   244	}
   245	

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