All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: kevin1.wang-5C7GfCeVMHo@public.gmane.org
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [bug report] drm/amd/powerplay: implement smc firmware v2.1 for smu11
Date: Mon, 19 Aug 2019 16:03:58 +0300	[thread overview]
Message-ID: <20190819130357.GA1615@mwanda> (raw)

Hello Kevin Wang,

The patch b55c83a7438d: "drm/amd/powerplay: implement smc firmware
v2.1 for smu11" from Jun 21, 2019, leads to the following static
checker warning:

	drivers/gpu/drm/amd/amdgpu/../powerplay/smu_v11_0.c:390 smu_v11_0_setup_pptable()
	warn: passing casted pointer '&size' to 'smu_get_atom_data_table()' 32 vs 16.

drivers/gpu/drm/amd/amdgpu/../powerplay/smu_v11_0.c
   357  static int smu_v11_0_setup_pptable(struct smu_context *smu)
   358  {
   359          struct amdgpu_device *adev = smu->adev;
   360          const struct smc_firmware_header_v1_0 *hdr;
   361          int ret, index;
   362          uint32_t size;
                ^^^^^^^^^^^^^

   363          uint8_t frev, crev;
   364          void *table;
   365          uint16_t version_major, version_minor;
   366  
   367          hdr = (const struct smc_firmware_header_v1_0 *) adev->pm.fw->data;
   368          version_major = le16_to_cpu(hdr->header.header_version_major);
   369          version_minor = le16_to_cpu(hdr->header.header_version_minor);
   370          if (version_major == 2 && smu->smu_table.boot_values.pp_table_id > 0) {
   371                  switch (version_minor) {
   372                  case 0:
   373                          ret = smu_v11_0_set_pptable_v2_0(smu, &table, &size);
   374                          break;
   375                  case 1:
   376                          ret = smu_v11_0_set_pptable_v2_1(smu, &table, &size,
   377                                                           smu->smu_table.boot_values.pp_table_id);
   378                          break;
   379                  default:
   380                          ret = -EINVAL;
   381                          break;
   382                  }
   383                  if (ret)
   384                          return ret;
   385  
   386          } else {
   387                  index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
   388                                                      powerplayinfo);
   389  
   390                  ret = smu_get_atom_data_table(smu, index, (uint16_t *)&size, &frev, &crev,
                                                                  ^^^^^^^^^^^^^^^^^
This only initializes the highest 16 bits.

   391                                                (uint8_t **)&table);
   392                  if (ret)
   393                          return ret;
   394          }
   395  
   396          if (!smu->smu_table.power_play_table)
   397                  smu->smu_table.power_play_table = table;
   398          if (!smu->smu_table.power_play_table_size)
   399                  smu->smu_table.power_play_table_size = size;
   400  
   401          return 0;

regards,
dan carpenter
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

             reply	other threads:[~2019-08-19 13:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 13:03 Dan Carpenter [this message]
2019-08-19 15:31 ` [bug report] drm/amd/powerplay: implement smc firmware v2.1 for smu11 Wang, Kevin(Yang)

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=20190819130357.GA1615@mwanda \
    --to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=kevin1.wang-5C7GfCeVMHo@public.gmane.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 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.