[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211109132651.GK2026@kadam>
Date: Tue, 9 Nov 2021 16:26:52 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Qing Wang <wangqing@...o.com>,
Gustavo Pimentel <gustavo.pimentel@...opsys.com>,
Vinod Koul <vkoul@...nel.org>, dmaengine@...r.kernel.org,
linux-kernel@...r.kernel.org,
Kernel Janitors <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH V2] dma: dw-edma-pcie: switch from 'pci_' to 'dma_' API
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
Powered by blists - more mailing lists