Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: cezary.rojewski@intel.com
Cc: alsa-devel@alsa-project.org
Subject: [bug report] ASoC: Intel: catpt: Firmware loading and context restore
Date: Sat, 10 Oct 2020 23:15:47 +0300	[thread overview]
Message-ID: <20201010201547.GA1890676@mwanda> (raw)

Hello Cezary Rojewski,

The patch a9aa6fb3eb6c: "ASoC: Intel: catpt: Firmware loading and
context restore" from Sep 29, 2020, leads to the following static
checker warning:

	sound/soc/intel/catpt/loader.c:654 catpt_first_boot_firmware()
	warn: consider using resource_size() here

sound/soc/intel/catpt/loader.c
   638  int catpt_first_boot_firmware(struct catpt_dev *cdev)
   639  {
   640          struct resource *res;
   641          int ret;
   642  
   643          ret = catpt_boot_firmware(cdev, false);
   644          if (ret) {
   645                  dev_err(cdev->dev, "basefw boot failed: %d\n", ret);
   646                  return ret;
   647          }
   648  
   649          /* restrict FW Core dump area */
   650          __request_region(&cdev->dram, 0, 0x200, NULL, 0);
   651          /* restrict entire area following BASE_FW - highest offset in DRAM */
   652          for (res = cdev->dram.child; res->sibling; res = res->sibling)
   653                  ;
   654          __request_region(&cdev->dram, res->end + 1,
   655                           cdev->dram.end - res->end, NULL, 0);
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^
It's been years since I have seen one of these warnings.  Back in the
day we used have have a lot of off by one warnings because resource_size()
is supposed to be calculated as "end - start + 1".  But here we are
calculating "dram.end - res->end" so I'm not sure if the math is correct
or not.  This is very new code so hopefully you know the answer off the
top of your head?

   656  
   657          ret = catpt_ipc_get_mixer_stream_info(cdev, &cdev->mixer);
   658          if (ret)
   659                  return CATPT_IPC_ERROR(ret);
   660  
   661          ret = catpt_arm_stream_templates(cdev);
   662          if (ret) {
   663                  dev_err(cdev->dev, "arm templates failed: %d\n", ret);
   664                  return ret;
   665          }
   666  
   667          /* update dram pg for scratch and restricted regions */
   668          catpt_dsp_update_srampge(cdev, &cdev->dram, cdev->spec->dram_mask);
   669  
   670          return 0;
   671  }

regards,
dan carpenter

             reply	other threads:[~2020-10-10 20:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-10 20:15 Dan Carpenter [this message]
2020-10-12  8:48 ` [bug report] ASoC: Intel: catpt: Firmware loading and context restore Rojewski, Cezary

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=20201010201547.GA1890676@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=cezary.rojewski@intel.com \
    /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