X86 platform drivers
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Cc: platform-driver-x86@vger.kernel.org
Subject: [bug report] platform/x86/amd/pmf: Add support for PMF-TA interaction
Date: Thu, 23 Apr 2026 10:09:39 +0300	[thread overview]
Message-ID: <aenFs-bOmM6VpO9W@stanley.mountain> (raw)

Hello Shyam Sundar S K,

Commit ae82cef7d9c5 ("platform/x86/amd/pmf: Add support for PMF-TA
interaction") from Dec 12, 2023 (linux-next), leads to the following
Smatch static checker warning:

drivers/platform/x86/amd/pmf/tee-if.c:261 amd_pmf_invoke_cmd_enact() warn: set error code if 'arg.ret != 0'
drivers/platform/x86/amd/pmf/tee-if.c:307 amd_pmf_invoke_cmd_init() warn: set error code if 'arg.ret != 0'

drivers/platform/x86/amd/pmf/tee-if.c
    234 int amd_pmf_invoke_cmd_enact(struct amd_pmf_dev *dev)
    235 {
    236         struct ta_pmf_shared_memory *ta_sm = NULL;
    237         struct ta_pmf_enact_result *out = NULL;
    238         struct ta_pmf_enact_table *in = NULL;
    239         struct tee_param param[MAX_TEE_PARAM];
    240         struct tee_ioctl_invoke_arg arg;
    241         int ret = 0;
    242 
    243         if (!dev->tee_ctx)
    244                 return -ENODEV;
    245 
    246         memset(dev->shbuf, 0, dev->policy_sz);
    247         ta_sm = dev->shbuf;
    248         out = &ta_sm->pmf_output.policy_apply_table;
    249         in = &ta_sm->pmf_input.enact_table;
    250 
    251         memset(ta_sm, 0, sizeof(*ta_sm));
    252         ta_sm->command_id = TA_PMF_COMMAND_POLICY_BUILDER_ENACT_POLICIES;
    253         ta_sm->if_version = PMF_TA_IF_VERSION_MAJOR;
    254 
    255         amd_pmf_populate_ta_inputs(dev, in);
    256         amd_pmf_prepare_args(dev, TA_PMF_COMMAND_POLICY_BUILDER_ENACT_POLICIES, &arg, param);
    257 
    258         ret = tee_client_invoke_func(dev->tee_ctx, &arg, param);
    259         if (ret < 0 || arg.ret != 0) {
    260                 dev_err(dev->dev, "TEE enact cmd failed. err: %x, ret:%d\n", arg.ret, ret);
--> 261                 return ret;

return ret ?: -EINVAL?  (not sure what kind of error codes are stored in
arg.ret).

    262         }
    263 
    264         if (ta_sm->pmf_result == TA_PMF_TYPE_SUCCESS && out->actions_count) {
    265                 amd_pmf_dump_ta_inputs(dev, in);
    266                 dev_dbg(dev->dev, "action count:%u result:%x\n", out->actions_count,
    267                         ta_sm->pmf_result);
    268                 amd_pmf_apply_policies(dev, out);
    269         }
    270 
    271         return 0;
    272 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

             reply	other threads:[~2026-04-23  7:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23  7:09 Dan Carpenter [this message]
2026-05-06  4:02 ` [bug report] platform/x86/amd/pmf: Add support for PMF-TA interaction Shyam Sundar S K

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=aenFs-bOmM6VpO9W@stanley.mountain \
    --to=error27@gmail.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /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