Re: [PATCH V2] dma: dw-edma-pcie: switch from 'pci_' to 'dma_' API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 09, 2021 at 04:21:37PM +0300, Dan Carpenter wrote:
> drivers/dma/dw-edma/dw-edma-pcie.c:192 dw_edma_pcie_probe() info: return a literal instead of 'err'
> 
> The idea of the Smatch check is that it's pretty easy to get "if (!ret)"
> and "if (ret)" transposed.  It would show up in testing, of course, but
> the truth is that maintainers don't always have all the hardware they
> maintain.
> 
> And the other idea is that "return 0;" is always more readable and
> intentional than "return ret;" where ret is zero.

So other style anti-patterns that this check finds are:

net/bluetooth/hci_sync.c
  4489  
  4490          err = hci_start_scan_sync(hdev, LE_SCAN_ACTIVE, interval,
  4491                                    hdev->le_scan_window_discovery,
  4492                                    own_addr_type, filter_policy, filter_dup);
  4493          if (!err)
  4494                  return err;

2) Success handling.
3) Making the last check special/opposite.

*sad face*

  4495  
  4496  failed:
  4497          /* Resume advertising if it was paused */
  4498          if (use_ll_privacy(hdev))


regards,
dan carpenter



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux