1. 05 Sep, 2019 37 commits
  2. 03 Sep, 2019 3 commits
    • Gustavo A. R. Silva's avatar
      zd1211rw: zd_usb: Use struct_size() helper · 84b0b663
      Gustavo A. R. Silva authored
      One of the more common cases of allocation size calculations is finding
      the size of a structure that has a zero-sized array at the end, along
      with memory for some number of elements for that array. For example:
      
      struct usb_int_regs {
      	...
              struct reg_data regs[0];
      } __packed;
      
      Make use of the struct_size() helper instead of an open-coded version
      in order to avoid any potential type mistakes.
      
      So, replace the following function:
      
      static int usb_int_regs_length(unsigned int count)
      {
             return sizeof(struct usb_int_regs) + count * sizeof(struct reg_data);
      }
      
      with:
      
      struct_size(regs, regs, count)
      
      This code was detected with the help of Coccinelle.
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      84b0b663
    • Rafał Miłecki's avatar
      brcmfmac: get chip's default RAM info during PCIe setup · 82f93cf4
      Rafał Miłecki authored
      Getting RAM info just once per driver's lifetime (during chip
      recognition) is not enough as it may get adjusted later (depending on
      the used firmware). Subsequent inits may load different firmwares so a
      full RAM recognition is required on every PCIe setup. This is especially
      important since implementing hardware reset on a firmware crash.
      
      Moreover calling brcmf_chip_get_raminfo() makes sure that RAM core is
      up. It's important as having BCMA_CORE_SYS_MEM down on BCM4366 was
      resulting in firmware failing to initialize and following error:
      [   65.657546] brcmfmac 0000:01:00.0: brcmf_pcie_download_fw_nvram: Invalid shared RAM address 0x04000001
      
      This change makes brcmf_chip_get_raminfo() call during chip recognition
      redundant for PCIe devices but SDIO and USB still need it and it's a
      very small overhead anyway.
      
      Fixes: 4684997d ("brcmfmac: reset PCIe bus on a firmware crash")
      Signed-off-by: default avatarRafał Miłecki <rafal@milecki.pl>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      82f93cf4
    • Colin Ian King's avatar
      bcma: fix incorrect update of BCMA_CORE_PCI_MDIO_DATA · 420c20be
      Colin Ian King authored
      An earlier commit re-worked the setting of the bitmask and is now
      assigning v with some bit flags rather than bitwise or-ing them
      into v, consequently the earlier bit-settings of v are being lost.
      Fix this by replacing an assignment with the bitwise or instead.
      
      Addresses-Coverity: ("Unused value")
      Fixes: 2be25cac ("bcma: add constants for PCI and use them")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      420c20be