Category: Linux

phy: Use PTR_ERR_OR_ZERO to fix warning raised by coccinelle

Author: Gregory CLEMENT <gregory.clement@free-electrons.com> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(…)) + PTR_ERR Generated by: coccinelle/api/ptr_ret.cocci Signed-off-by: Gregory CLEMENT Acked-by: Jason Cooper Signed-off-by: Kishon Vijay Abraham I — drivers/phy/phy-berlin-sata.c | 5 +—- drivers/phy/phy-hix5hd2-sata.c | 5 +—- drivers/phy/phy-miphy365x.c | 5 +—- drivers/phy/phy-stih41x-usb.c | 5 +—- 4 files changed, 4 insertions(+), 16 deletions(-)   diff –git a/drivers/phy/phy-berlin-sata.c b/drivers/phy/phy-berlin-sata.c index …

Continue reading

PCI: Delete unnecessary NULL pointer checks

Author: Markus Elfring <elfring@users.sourceforge.net> The functions pci_dev_put(), pci_pme_wakeup_bus(), and put_device() return immediately if their argument is NULL. Thus the test before the call is not needed. Remove these unnecessary tests. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Bjorn Helgaas — drivers/pci/pci-acpi.c | 3 +– drivers/pci/probe.c | 3 +– drivers/pci/search.c …

Continue reading

staging: lustre: osc: remove final uses of the GOTO macro

Author: Julia Lawall <Julia.Lawall@lip6.fr> The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ identifier lbl; identifier rc; constant c; @@ – GOTO(lbl,\(rc\|c\)); + goto lbl; @@ identifier lbl; expression rc; @@ – GOTO(lbl,rc); + rc; + goto lbl; // In one case (OES_INV), consecutive gotos were factorized and a break was …

Continue reading

PCI: Simplify if-return sequences

Author: Quentin Lambert <lambert.quentin@gmail.com> Simplify a trivial if-return sequence. Possibly combine with a preceding function call. Generated by: scripts/coccinelle/misc/simple_return.cocci Signed-off-by: Quentin Lambert Signed-off-by: Bjorn Helgaas — drivers/pci/hotplug/ibmphp_res.c | 5 +—- drivers/pci/pci.c | 6 +—– 2 files changed, 2 insertions(+), 9 deletions(-)   diff –git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c index 219ba80..f279060 100644 — a/drivers/pci/hotplug/ibmphp_res.c +++ b/drivers/pci/hotplug/ibmphp_res.c @@ -376,10 …

Continue reading

dmaengine: at_xdmac: fix semicolon.cocci warnings

Author: kbuild test robot <fengguang.wu@intel.com> drivers/dma/at_xdmac.c:702:3-4: Unneeded semicolon Removes unneeded semicolon. Generated by: scripts/coccinelle/misc/semicolon.cocci Signed-off-by: Fengguang Wu Signed-off-by: Vinod Koul — drivers/dma/at_xdmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)   diff –git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index 4e9b023..155577b 100644 — a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -699,7 +699,7 @@ at_xdmac_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, desc->lld.mbr_sa = …

Continue reading

at86rf230: fix simple_return.cocci warnings

Author: Fengguang Wu <fengguang.wu@intel.com> drivers/net/ieee802154/at86rf230.c:1365:1-3: WARNING: end returns can be simpified Simplify a trivial if-return sequence. Possibly combine with a preceding function call. Generated by: scripts/coccinelle/misc/simple_return.cocci Signed-off-by: Fengguang Wu Acked-by: Alexander Aring Signed-off-by: Marcel Holtmann — drivers/net/ieee802154/at86rf230.c | 6 +—– 1 file changed, 1 insertion(+), 5 deletions(-)   diff –git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index a3cc7d9..ebcbeb3 100644 …

Continue reading

ALSA: emu10k1: Deletion of unnecessary checks before three function calls

Author: Markus Elfring <elfring@users.sourceforge.net> The functions kfree(), release_firmware() and snd_util_memhdr_free() test whether their argument is NULL and then return immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai — sound/pci/emu10k1/emu10k1_main.c | 9 +++—— sound/pci/emu10k1/emufx.c | 3 +– 2 files …

Continue reading

ceph, rbd: delete unnecessary checks before two function calls

Author: SF Markus Elfring <elfring@users.sourceforge.net> The functions ceph_put_snap_context() and iput() test whether their argument is NULL and then return immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring [idryomov@redhat.com: squashed rbd.c hunk, changelog] Signed-off-by: Ilya Dryomov — drivers/block/rbd.c | 3 +– fs/ceph/caps.c …

Continue reading

Staging: rtl8188eu: Use put_unaligned_le32

Author: Vaishali Thakkar <vthakkar1994@gmail.com> This patch introduces the use of function put_unaligned_le32. This is done using Coccinelle and semantic patch used is as follows: @@ identifier tmp; expression ptr; expression y,e; type T; @@ – tmp = cpu_to_le32(y); ? tmp = e @@ type T; identifier tmp; @@ – T tmp; …when != tmp Signed-off-by: …

Continue reading

Staging: rtl8192u: Use put_unaligned_le16

Author: Vaishali Thakkar <vthakkar1994@gmail.com> This patch introduces the use of function put_unaligned_le16. This is done using Coccinelle and semantic patch used is as follows: @@ identifier tmp; expression ptr; expression y,e; type T; @@ – tmp = cpu_to_le16(y); ? tmp = e @@ type T; identifier tmp; @@ – T tmp; …when != tmp Here, …

Continue reading