14 Feb
2019
14 Feb
'19
2:45 p.m.
On Wed, Feb 13, 2019 at 04:07:28PM -0600, Pierre-Louis Bossart wrote:
From: Liam Girdwood liam.r.girdwood@linux.intel.com
Add operation pointers that can be called by core to control a wide variety of DSP targets. The DSP HW drivers will fill in these operations.
+int snd_sof_pci_update_bits_unlocked(struct snd_sof_dev *sdev, u32 offset,
u32 mask, u32 value)
+{
- struct pci_dev *pci = to_pci_dev(sdev->dev);
- unsigned int old, new;
- u32 ret = ~0; /* explicit init to remove uninitialized use warnings */
In case you handle pci_read_config_dword() errors, would you get same warning?
Something like
unsigned int old, new; int ret;
ret = pci_read_config_dword(..., &old); if (ret) return -ENXIO;
...
I really don't like such assignments that potentially can shadow a real corner cases.
- pci_read_config_dword(pci, offset, &ret);
- old = ret;
- dev_dbg(sdev->dev, "Debug PCIR: %8.8x at %8.8x\n", old & mask, offset);
- new = (old & (~mask)) | (value & mask);
(~mask) -> ~mask.
- if (old == new)
return false;
- pci_write_config_dword(pci, offset, new);
- dev_dbg(sdev->dev, "Debug PCIW: %8.8x at %8.8x\n", value,
offset);
- return true;
+}
--
With Best Regards,
Andy Shevchenko