[PATCH] net: nvidia: forcedeth: Drop a condition with no effect

2020-06-02 Thread Aishwarya Ramakrishnan
As the "else if" and "else" branch body are identical the
condition has no effect. So removing "else if" condition.

Signed-off-by: Aishwarya Ramakrishnan 
---
 drivers/net/ethernet/nvidia/forcedeth.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/nvidia/forcedeth.c 
b/drivers/net/ethernet/nvidia/forcedeth.c
index 2fc10a36afa4..87ed7e192ce9 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -3476,9 +3476,6 @@ static int nv_update_linkspeed(struct net_device *dev)
} else if (adv_lpa & LPA_10FULL) {
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;
newdup = 1;
-   } else if (adv_lpa & LPA_10HALF) {
-   newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;
-   newdup = 0;
} else {
newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;
newdup = 0;
-- 
2.17.1



[PATCH] net: stmmac: Drop condition with no effect

2020-06-02 Thread Aishwarya Ramakrishnan
As the "else if" and "else" branch body are identical the
condition has no effect. So removing "else if" condition.

Signed-off-by: Aishwarya Ramakrishnan 
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index bcda49dcf619..f59813a0405c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -229,8 +229,6 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
plat->tx_sched_algorithm = MTL_TX_ALGORITHM_WFQ;
else if (of_property_read_bool(tx_node, "snps,tx-sched-dwrr"))
plat->tx_sched_algorithm = MTL_TX_ALGORITHM_DWRR;
-   else if (of_property_read_bool(tx_node, "snps,tx-sched-sp"))
-   plat->tx_sched_algorithm = MTL_TX_ALGORITHM_SP;
else
plat->tx_sched_algorithm = MTL_TX_ALGORITHM_SP;
 
-- 
2.17.1



[PATCH] drm/amdkfd: Fix boolreturn.cocci warnings

2020-05-18 Thread Aishwarya Ramakrishnan
Return statements in functions returning bool should use
true/false instead of 1/0.

drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c:40:9-10:
WARNING: return of 0/1 in function 'event_interrupt_isr_v9' with return type 
bool

Generated by: scripts/coccinelle/misc/boolreturn.cocci

Signed-off-by: Aishwarya Ramakrishnan 
---
 drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c
index e05d75ecda21..fce6ccabe38b 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c
@@ -37,7 +37,7 @@ static bool event_interrupt_isr_v9(struct kfd_dev *dev,
vmid = SOC15_VMID_FROM_IH_ENTRY(ih_ring_entry);
if (vmid < dev->vm_info.first_vmid_kfd ||
vmid > dev->vm_info.last_vmid_kfd)
-   return 0;
+   return false;
 
source_id = SOC15_SOURCE_ID_FROM_IH_ENTRY(ih_ring_entry);
client_id = SOC15_CLIENT_ID_FROM_IH_ENTRY(ih_ring_entry);
@@ -69,7 +69,7 @@ static bool event_interrupt_isr_v9(struct kfd_dev *dev,
 
/* If there is no valid PASID, it's likely a bug */
if (WARN_ONCE(pasid == 0, "Bug: No PASID in KFD interrupt"))
-   return 0;
+   return false;
 
/* Interrupt types we care about: various signals and faults.
 * They will be forwarded to a work queue (see below).
-- 
2.17.1



[PATCH] drm/i915/gvt: Use ARRAY_SIZE for vgpu_types

2020-05-18 Thread Aishwarya Ramakrishnan
Prefer ARRAY_SIZE instead of using sizeof

Fixes coccicheck warning: Use ARRAY_SIZE

Signed-off-by: Aishwarya Ramakrishnan 
---
 drivers/gpu/drm/i915/gvt/vgpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
index 1d5ff88078bd..7d361623ff67 100644
--- a/drivers/gpu/drm/i915/gvt/vgpu.c
+++ b/drivers/gpu/drm/i915/gvt/vgpu.c
@@ -124,7 +124,7 @@ int intel_gvt_init_vgpu_types(struct intel_gvt *gvt)
 */
low_avail = gvt_aperture_sz(gvt) - HOST_LOW_GM_SIZE;
high_avail = gvt_hidden_sz(gvt) - HOST_HIGH_GM_SIZE;
-   num_types = sizeof(vgpu_types) / sizeof(vgpu_types[0]);
+   num_types = ARRAY_SIZE(vgpu_types);
 
gvt->types = kcalloc(num_types, sizeof(struct intel_vgpu_type),
 GFP_KERNEL);
-- 
2.17.1



[PATCH] Input: edt-ft5x06: Use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs fops

2020-05-06 Thread Aishwarya Ramakrishnan
From: Aishwarya Ramakrishnan 

On Tue, May 5, 2020 at 11:49 PM Greg Kroah-Hartman  
wrote:
> On Tue, May 05, 2020 at 09:03:24PM +0530, Aishwarya Ramakrishnan wrote:
>> It is more clear to use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs file
>> operation rather than DEFINE_SIMPLE_ATTRIBUTE.

> No it is not, why do you think so?

This change is suggested by Coccinelle software.
Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

> The two defines do different things, that is why we have 2 different
> defines.  You can not just replace one with the other without
> understanding why one was used and not the other one.

> Did you test this change to verify that everything still works
> properly?  Why is it needed to be changed at all?

DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
imposes some significant overhead as compared to
DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().
But I missed to use debugfs_create_file_unsafe() function in the patch.


[PATCH] Input: edt-ft5x06: Use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs fops

2020-05-05 Thread Aishwarya Ramakrishnan
It is more clear to use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs file
operation rather than DEFINE_SIMPLE_ATTRIBUTE.

Signed-off-by: Aishwarya Ramakrishnan 
---
 drivers/input/touchscreen/edt-ft5x06.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/edt-ft5x06.c 
b/drivers/input/touchscreen/edt-ft5x06.c
index d2587724c52a..7f2070fde2ae 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -676,7 +676,7 @@ static int edt_ft5x06_debugfs_mode_set(void *data, u64 mode)
return retval;
 };
 
-DEFINE_SIMPLE_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get,
+DEFINE_DEBUGFS_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get,
edt_ft5x06_debugfs_mode_set, "%llu\n");
 
 static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file,
-- 
2.17.1



[PATCH] phy: tegra: Use PTR_ERR_OR_ZERO() to simplify code

2020-05-05 Thread Aishwarya Ramakrishnan
PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR.

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Aishwarya Ramakrishnan 
---
 drivers/phy/tegra/phy-tegra194-p2u.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/phy/tegra/phy-tegra194-p2u.c 
b/drivers/phy/tegra/phy-tegra194-p2u.c
index 7042bed9feaa..42394d27f4cb 100644
--- a/drivers/phy/tegra/phy-tegra194-p2u.c
+++ b/drivers/phy/tegra/phy-tegra194-p2u.c
@@ -92,10 +92,7 @@ static int tegra_p2u_probe(struct platform_device *pdev)
phy_set_drvdata(generic_phy, phy);
 
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
-   if (IS_ERR(phy_provider))
-   return PTR_ERR(phy_provider);
-
-   return 0;
+   return PTR_ERR_OR_ZERO(phy_provider);
 }
 
 static const struct of_device_id tegra_p2u_id_table[] = {
-- 
2.17.1



[PATCH] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code

2020-05-05 Thread Aishwarya Ramakrishnan
PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR.

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Aishwarya Ramakrishnan 
---
 drivers/i2c/busses/i2c-nvidia-gpu.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c 
b/drivers/i2c/busses/i2c-nvidia-gpu.c
index f5d25ce00f03..f480105000b8 100644
--- a/drivers/i2c/busses/i2c-nvidia-gpu.c
+++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
@@ -277,10 +277,7 @@ static int gpu_populate_client(struct gpu_i2c_dev *i2cd, 
int irq)
i2cd->gpu_ccgx_ucsi->irq = irq;
i2cd->gpu_ccgx_ucsi->properties = ccgx_props;
i2cd->ccgx_client = i2c_new_client_device(>adapter, 
i2cd->gpu_ccgx_ucsi);
-   if (IS_ERR(i2cd->ccgx_client))
-   return PTR_ERR(i2cd->ccgx_client);
-
-   return 0;
+   return PTR_ERR_OR_ZERO(i2cd->ccgx_client);
 }
 
 static int gpu_i2c_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-- 
2.17.1



[PATCH] i2c: drivers: Remove superfluous error message

2020-05-04 Thread Aishwarya Ramakrishnan
The function platform_get_irq can log an error by itself.
This omit a redundant message for exception handling in the
calling function.

Suggested by Coccinelle.

Signed-off-by: Aishwarya Ramakrishnan 
---
 drivers/i2c/busses/i2c-altera.c   | 4 +---
 drivers/i2c/busses/i2c-cht-wc.c   | 4 +---
 drivers/i2c/busses/i2c-img-scb.c  | 4 +---
 drivers/i2c/busses/i2c-lpc2k.c| 4 +---
 drivers/i2c/busses/i2c-uniphier.c | 4 +---
 5 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/i2c/busses/i2c-altera.c b/drivers/i2c/busses/i2c-altera.c
index f5c00f903df3..af6985f0ae63 100644
--- a/drivers/i2c/busses/i2c-altera.c
+++ b/drivers/i2c/busses/i2c-altera.c
@@ -395,10 +395,8 @@ static int altr_i2c_probe(struct platform_device *pdev)
return PTR_ERR(idev->base);
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   dev_err(>dev, "missing interrupt resource\n");
+   if (irq < 0)
return irq;
-   }
 
idev->i2c_clk = devm_clk_get(>dev, NULL);
if (IS_ERR(idev->i2c_clk)) {
diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
index 35e55feda763..343ae5754e6e 100644
--- a/drivers/i2c/busses/i2c-cht-wc.c
+++ b/drivers/i2c/busses/i2c-cht-wc.c
@@ -314,10 +314,8 @@ static int cht_wc_i2c_adap_i2c_probe(struct 
platform_device *pdev)
int ret, reg, irq;
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   dev_err(>dev, "Error missing irq resource\n");
+   if (irq < 0)
return -EINVAL;
-   }
 
adap = devm_kzalloc(>dev, sizeof(*adap), GFP_KERNEL);
if (!adap)
diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
index 422097a31c95..2f6de763816a 100644
--- a/drivers/i2c/busses/i2c-img-scb.c
+++ b/drivers/i2c/busses/i2c-img-scb.c
@@ -1344,10 +1344,8 @@ static int img_i2c_probe(struct platform_device *pdev)
return PTR_ERR(i2c->base);
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   dev_err(>dev, "can't get irq number\n");
+   if (irq < 0)
return irq;
-   }
 
i2c->sys_clk = devm_clk_get(>dev, "sys");
if (IS_ERR(i2c->sys_clk)) {
diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c
index 13b0c12e2dba..43dc9b7043e4 100644
--- a/drivers/i2c/busses/i2c-lpc2k.c
+++ b/drivers/i2c/busses/i2c-lpc2k.c
@@ -362,10 +362,8 @@ static int i2c_lpc2k_probe(struct platform_device *pdev)
return PTR_ERR(i2c->base);
 
i2c->irq = platform_get_irq(pdev, 0);
-   if (i2c->irq < 0) {
-   dev_err(>dev, "can't get interrupt resource\n");
+   if (i2c->irq < 0)
return i2c->irq;
-   }
 
init_waitqueue_head(>wait);
 
diff --git a/drivers/i2c/busses/i2c-uniphier.c 
b/drivers/i2c/busses/i2c-uniphier.c
index 668b1fa2b0ef..ee00a44bf4c7 100644
--- a/drivers/i2c/busses/i2c-uniphier.c
+++ b/drivers/i2c/busses/i2c-uniphier.c
@@ -324,10 +324,8 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
return PTR_ERR(priv->membase);
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   dev_err(dev, "failed to get IRQ number\n");
+   if (irq < 0)
return irq;
-   }
 
if (of_property_read_u32(dev->of_node, "clock-frequency", _speed))
bus_speed = I2C_MAX_STANDARD_MODE_FREQ;
-- 
2.17.1



[PATCH] i2c: cht-wc: Remove superfluous error message in cht_wc_i2c_adap_i2c_probe()

2020-05-03 Thread Aishwarya Ramakrishnan
The function platform_get_irq can log an error by itself.
This omit a redundant message for exception handling in the
calling function.

Suggested by Coccinelle.

Signed-off-by: Aishwarya Ramakrishnan 
---
 drivers/i2c/busses/i2c-cht-wc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
index 35e55feda763..343ae5754e6e 100644
--- a/drivers/i2c/busses/i2c-cht-wc.c
+++ b/drivers/i2c/busses/i2c-cht-wc.c
@@ -314,10 +314,8 @@ static int cht_wc_i2c_adap_i2c_probe(struct 
platform_device *pdev)
int ret, reg, irq;
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   dev_err(>dev, "Error missing irq resource\n");
+   if (irq < 0)
return -EINVAL;
-   }
 
adap = devm_kzalloc(>dev, sizeof(*adap), GFP_KERNEL);
if (!adap)
-- 
2.17.1



[PATCH] i2c: img-scb: Use devm_platform_ioremap_resource and remove superfluous error message.

2020-05-03 Thread Aishwarya Ramakrishnan
Use the helper function that wraps the calls to
platform_get_resource() and devm_ioremap_resource()
together.

The function platform_get_irq can log an error by itself.
Omit a redundant message for exception handling in the
calling function.

Suggested by coccinelle.

Signed-off-by: Aishwarya Ramakrishnan 
---
 drivers/i2c/busses/i2c-img-scb.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
index 422097a31c95..98a89301ed2a 100644
--- a/drivers/i2c/busses/i2c-img-scb.c
+++ b/drivers/i2c/busses/i2c-img-scb.c
@@ -1330,7 +1330,6 @@ static int img_i2c_probe(struct platform_device *pdev)
 {
struct device_node *node = pdev->dev.of_node;
struct img_i2c *i2c;
-   struct resource *res;
int irq, ret;
u32 val;
 
@@ -1338,16 +1337,13 @@ static int img_i2c_probe(struct platform_device *pdev)
if (!i2c)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   i2c->base = devm_ioremap_resource(>dev, res);
+   i2c->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(i2c->base))
return PTR_ERR(i2c->base);
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   dev_err(>dev, "can't get irq number\n");
+   if (irq < 0)
return irq;
-   }
 
i2c->sys_clk = devm_clk_get(>dev, "sys");
if (IS_ERR(i2c->sys_clk)) {
-- 
2.17.1



[PATCH] i2c: altera: Remove superfluous error message in altr_i2c_probe()

2020-05-03 Thread Aishwarya Ramakrishnan
The function platform_get_irq can log an error by itself.
This omit a redundant message for exception handling in the
calling function.

Suggested by Coccinelle.

Signed-off-by: Aishwarya Ramakrishnan 
---
 drivers/i2c/busses/i2c-altera.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-altera.c b/drivers/i2c/busses/i2c-altera.c
index f5c00f903df3..af6985f0ae63 100644
--- a/drivers/i2c/busses/i2c-altera.c
+++ b/drivers/i2c/busses/i2c-altera.c
@@ -395,10 +395,8 @@ static int altr_i2c_probe(struct platform_device *pdev)
return PTR_ERR(idev->base);
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   dev_err(>dev, "missing interrupt resource\n");
+   if (irq < 0)
return irq;
-   }
 
idev->i2c_clk = devm_clk_get(>dev, NULL);
if (IS_ERR(idev->i2c_clk)) {
-- 
2.17.1



[PATCH] i2c: lpc2k: Remove superfluous error message in i2c_lpc2k_probe()

2020-05-03 Thread Aishwarya Ramakrishnan
The function platform_get_irq can log an error by itself.
This omit a redundant message for exception handling in the
calling function.

Suggested by Coccinelle.

Signed-off-by: Aishwarya Ramakrishnan 
---
 drivers/i2c/busses/i2c-lpc2k.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c
index 13b0c12e2dba..43dc9b7043e4 100644
--- a/drivers/i2c/busses/i2c-lpc2k.c
+++ b/drivers/i2c/busses/i2c-lpc2k.c
@@ -362,10 +362,8 @@ static int i2c_lpc2k_probe(struct platform_device *pdev)
return PTR_ERR(i2c->base);
 
i2c->irq = platform_get_irq(pdev, 0);
-   if (i2c->irq < 0) {
-   dev_err(>dev, "can't get interrupt resource\n");
+   if (i2c->irq < 0)
return i2c->irq;
-   }
 
init_waitqueue_head(>wait);
 
-- 
2.17.1



[PATCH] i2c: uniphier: Remove superfluous error message in uniphier_i2c_probe()

2020-05-03 Thread Aishwarya Ramakrishnan
The function platform_get_irq can log an error by itself.
This omit a redundant message for exception handling in the
calling function.

Suggested by Coccinelle.

Signed-off-by: Aishwarya Ramakrishnan 
---
 drivers/i2c/busses/i2c-uniphier.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-uniphier.c 
b/drivers/i2c/busses/i2c-uniphier.c
index 668b1fa2b0ef..ee00a44bf4c7 100644
--- a/drivers/i2c/busses/i2c-uniphier.c
+++ b/drivers/i2c/busses/i2c-uniphier.c
@@ -324,10 +324,8 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
return PTR_ERR(priv->membase);
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   dev_err(dev, "failed to get IRQ number\n");
+   if (irq < 0)
return irq;
-   }
 
if (of_property_read_u32(dev->of_node, "clock-frequency", _speed))
bus_speed = I2C_MAX_STANDARD_MODE_FREQ;
-- 
2.17.1