All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] ASoC: Intel: catpt: Firmware loading and context restore
@ 2020-10-10 20:15 Dan Carpenter
  2020-10-12  8:48 ` Rojewski, Cezary
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-10-10 20:15 UTC (permalink / raw)
  To: cezary.rojewski; +Cc: alsa-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-12  8:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-10 20:15 [bug report] ASoC: Intel: catpt: Firmware loading and context restore Dan Carpenter
2020-10-12  8:48 ` Rojewski, Cezary

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.