X86 platform drivers
 help / color / mirror / Atom feed
From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
To: Dan Carpenter <error27@gmail.com>
Cc: platform-driver-x86@vger.kernel.org
Subject: Re: [bug report] platform/x86/amd/pmf: Add support for PMF-TA interaction
Date: Wed, 6 May 2026 09:32:27 +0530	[thread overview]
Message-ID: <5e7d4a67-7da0-4b4e-b3f5-e5507f8e7969@amd.com> (raw)
In-Reply-To: <aenFs-bOmM6VpO9W@stanley.mountain>

Hi Dan,

I was OOO. Apologies for the long delay in responding back on this
thread.

On 4/23/2026 12:39, Dan Carpenter wrote:
> [You don't often get email from error27@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> 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).

Yes.

return ret ?: -EINVAL is the right thing to do in this case.

But I quickly ran the smatch and could not catch the problem what you
is being reported. Can you let me know how to trigger this warning?

Thanks,
Shyam

> 
>     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-05-06  4:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23  7:09 [bug report] platform/x86/amd/pmf: Add support for PMF-TA interaction Dan Carpenter
2026-05-06  4:02 ` Shyam Sundar S K [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=5e7d4a67-7da0-4b4e-b3f5-e5507f8e7969@amd.com \
    --to=shyam-sundar.s-k@amd.com \
    --cc=error27@gmail.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