Linux-PCI Archive on lore.kernel.org
 help / color / Atom feed
* pci-exynos.c coverity issue #1437287
@ 2020-10-27 16:34 Bjorn Helgaas
  2020-10-27 16:40 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Bjorn Helgaas @ 2020-10-27 16:34 UTC (permalink / raw)
  To: Jingoo Han; +Cc: linux-pci, linux-samsung-soc, Kukjin Kim, Krzysztof Kozlowski

Hi Jingoo,

Please take a look at this issue reported by Coverity:

222 static void exynos_pcie_assert_reset(struct exynos_pcie *ep)
223 {
224        struct dw_pcie *pci = ep->pci;
225        struct device *dev = pci->dev;
226
   	1. Condition ep->reset_gpio >= 0, taking true branch.
227        if (ep->reset_gpio >= 0)

CID 1437287 (#1 of 1): Unchecked return value (CHECKED_RETURN) 2.
check_return: Calling devm_gpio_request_one without checking return
value (as is done elsewhere 112 out of 113 times).

228                devm_gpio_request_one(dev, ep->reset_gpio,
229                                GPIOF_OUT_INIT_HIGH, "RESET");


Maybe you can guarantee that it's safe to ignore the return value by
doing a lot of code analysis, but I think it would be better to check
like all the other callers do.

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

* Re: pci-exynos.c coverity issue #1437287
  2020-10-27 16:34 pci-exynos.c coverity issue #1437287 Bjorn Helgaas
@ 2020-10-27 16:40 ` Krzysztof Kozlowski
  2020-10-27 17:14   ` Bjorn Helgaas
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2020-10-27 16:40 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jingoo Han, linux-pci, linux-samsung-soc, Kukjin Kim, Marek Szyprowski

On Tue, Oct 27, 2020 at 11:34:46AM -0500, Bjorn Helgaas wrote:
> Hi Jingoo,
> 
> Please take a look at this issue reported by Coverity:
> 
> 222 static void exynos_pcie_assert_reset(struct exynos_pcie *ep)
> 223 {
> 224        struct dw_pcie *pci = ep->pci;
> 225        struct device *dev = pci->dev;
> 226
>    	1. Condition ep->reset_gpio >= 0, taking true branch.
> 227        if (ep->reset_gpio >= 0)
> 
> CID 1437287 (#1 of 1): Unchecked return value (CHECKED_RETURN) 2.
> check_return: Calling devm_gpio_request_one without checking return
> value (as is done elsewhere 112 out of 113 times).
> 
> 228                devm_gpio_request_one(dev, ep->reset_gpio,
> 229                                GPIOF_OUT_INIT_HIGH, "RESET");
> 
> 
> Maybe you can guarantee that it's safe to ignore the return value by
> doing a lot of code analysis, but I think it would be better to check
> like all the other callers do.

+Cc Marek,

Hi Bjorn,

I think this is being removed by Marek's patchset:
https://lore.kernel.org/linux-samsung-soc/20201023075744.26200-1-m.szyprowski@samsung.com/

Best regards,
Krzysztof


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

* Re: pci-exynos.c coverity issue #1437287
  2020-10-27 16:40 ` Krzysztof Kozlowski
@ 2020-10-27 17:14   ` Bjorn Helgaas
  0 siblings, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2020-10-27 17:14 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jingoo Han, linux-pci, linux-samsung-soc, Kukjin Kim, Marek Szyprowski

On Tue, Oct 27, 2020 at 05:40:42PM +0100, Krzysztof Kozlowski wrote:
> On Tue, Oct 27, 2020 at 11:34:46AM -0500, Bjorn Helgaas wrote:
> > Hi Jingoo,
> > 
> > Please take a look at this issue reported by Coverity:
> > 
> > 222 static void exynos_pcie_assert_reset(struct exynos_pcie *ep)
> > 223 {
> > 224        struct dw_pcie *pci = ep->pci;
> > 225        struct device *dev = pci->dev;
> > 226
> >    	1. Condition ep->reset_gpio >= 0, taking true branch.
> > 227        if (ep->reset_gpio >= 0)
> > 
> > CID 1437287 (#1 of 1): Unchecked return value (CHECKED_RETURN) 2.
> > check_return: Calling devm_gpio_request_one without checking return
> > value (as is done elsewhere 112 out of 113 times).
> > 
> > 228                devm_gpio_request_one(dev, ep->reset_gpio,
> > 229                                GPIOF_OUT_INIT_HIGH, "RESET");
> > 
> > 
> > Maybe you can guarantee that it's safe to ignore the return value by
> > doing a lot of code analysis, but I think it would be better to check
> > like all the other callers do.
> 
> +Cc Marek,
> 
> Hi Bjorn,
> 
> I think this is being removed by Marek's patchset:
> https://lore.kernel.org/linux-samsung-soc/20201023075744.26200-1-m.szyprowski@samsung.com/

Perfect, thanks!

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-27 16:34 pci-exynos.c coverity issue #1437287 Bjorn Helgaas
2020-10-27 16:40 ` Krzysztof Kozlowski
2020-10-27 17:14   ` Bjorn Helgaas

Linux-PCI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pci/0 linux-pci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pci linux-pci/ https://lore.kernel.org/linux-pci \
		linux-pci@vger.kernel.org
	public-inbox-index linux-pci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git