[PATCH] dmaengine: bam_dma: fix return of bam_dma_irq()

2020-12-06 Thread Parth Y Shah
While performing suspend/resume, we were getting below kernel crash.

[   54.541672] [FTS][Info]gesture suspend...
[   54.605256] [FTS][Error][GESTURE]Enter into gesture(suspend) failed!
[   54.605256]
[   58.345850] irq event 10: bogus return value fff3
..

[   58.345966] [] el1_irq+0xb0/0x124
[   58.345971] [] arch_cpu_idle+0x10/0x18
[   58.345975] [] do_idle+0x1ac/0x1e0
[   58.345979] [] cpu_startup_entry+0x20/0x28
[   58.345983] [] rest_init+0xd0/0xdc
[   58.345988] [] start_kernel+0x390/0x3a4
[   58.345990] handlers:
[   58.345994] [] bam_dma_irq

The reason for the crash we found is, bam_dma_irq() was returning
negative value when the device resumes in some conditions.

In addition, the irq handler should have one of the below return values.

IRQ_NONEinterrupt was not from this device or was not handled
IRQ_HANDLED interrupt was handled by this device
IRQ_WAKE_THREAD handler requests to wake the handler thread

Therefore, to resolve this crash, we have changed the return value to
IRQ_NONE.

Signed-off-by: Parth Y Shah 
---
 drivers/dma/qcom/bam_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 4eeb8bb..d5773d4 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -875,7 +875,7 @@ static irqreturn_t bam_dma_irq(int irq, void *data)
 
ret = bam_pm_runtime_get_sync(bdev->dev);
if (ret < 0)
-   return ret;
+   return IRQ_NONE;
 
if (srcs & BAM_IRQ) {
clr_mask = readl_relaxed(bam_addr(bdev, 0, BAM_IRQ_STTS));
-- 
2.7.4



[PATCH] Fixes kernel crash generating from bam_dma_irq()

2020-12-06 Thread Parth Y Shah
While performing suspend/resume, we were getting below kernel crash.

[   54.541672] [FTS][Info]gesture suspend...
[   54.605256] [FTS][Error][GESTURE]Enter into gesture(suspend) failed!
[   54.605256]
[   58.345850] irq event 10: bogus return value fff3
..

[   58.345966] [] el1_irq+0xb0/0x124
[   58.345971] [] arch_cpu_idle+0x10/0x18
[   58.345975] [] do_idle+0x1ac/0x1e0
[   58.345979] [] cpu_startup_entry+0x20/0x28
[   58.345983] [] rest_init+0xd0/0xdc
[   58.345988] [] start_kernel+0x390/0x3a4
[   58.345990] handlers:
[   58.345994] [] bam_dma_irq

The reason for the crash we found is, bam_dma_irq() was returning
negative value when the device resumes in some conditions.

In addition, the irq handler should have one of the below return values.

IRQ_NONEinterrupt was not from this device or was not handled
IRQ_HANDLED interrupt was handled by this device
IRQ_WAKE_THREAD handler requests to wake the handler thread

Therefore, to resolve this crash, we have changed the return value to
IRQ_NONE.

Signed-off-by: Parth Y Shah 
---
 drivers/dma/qcom/bam_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 4eeb8bb..d5773d4 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -875,7 +875,7 @@ static irqreturn_t bam_dma_irq(int irq, void *data)
 
ret = bam_pm_runtime_get_sync(bdev->dev);
if (ret < 0)
-   return ret;
+   return IRQ_NONE;
 
if (srcs & BAM_IRQ) {
clr_mask = readl_relaxed(bam_addr(bdev, 0, BAM_IRQ_STTS));
-- 
2.7.4



[PATCH] misc: lkdtm: fixed static variable initialization

2018-08-06 Thread Parth Y Shah
Resolved "ERROR: do not initialise statics to 0"

Signed-off-by: Parth Y Shah 
---
 drivers/misc/lkdtm/usercopy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/lkdtm/usercopy.c b/drivers/misc/lkdtm/usercopy.c
index 9725aed..d8157b8 100644
--- a/drivers/misc/lkdtm/usercopy.c
+++ b/drivers/misc/lkdtm/usercopy.c
@@ -18,7 +18,7 @@
  * hardened usercopy checks by added "unconst" to all the const copies,
  * and making sure "cache_size" isn't optimized into a const.
  */
-static volatile size_t unconst = 0;
+static volatile size_t unconst;
 static volatile size_t cache_size = 1024;
 static struct kmem_cache *whitelist_cache;
 
-- 
2.7.4



[PATCH] misc: lkdtm: fixed static variable initialization

2018-08-06 Thread Parth Y Shah
Resolved "ERROR: do not initialise statics to 0"

Signed-off-by: Parth Y Shah 
---
 drivers/misc/lkdtm/usercopy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/lkdtm/usercopy.c b/drivers/misc/lkdtm/usercopy.c
index 9725aed..d8157b8 100644
--- a/drivers/misc/lkdtm/usercopy.c
+++ b/drivers/misc/lkdtm/usercopy.c
@@ -18,7 +18,7 @@
  * hardened usercopy checks by added "unconst" to all the const copies,
  * and making sure "cache_size" isn't optimized into a const.
  */
-static volatile size_t unconst = 0;
+static volatile size_t unconst;
 static volatile size_t cache_size = 1024;
 static struct kmem_cache *whitelist_cache;
 
-- 
2.7.4



[PATCH] misc: eeprom: assignment outside the if statement

2018-08-03 Thread Parth Y Shah
Assignment of any variable should be kept outside the if statement

Signed-off-by: Parth Y Shah 
---
 drivers/misc/eeprom/max6875.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/eeprom/max6875.c b/drivers/misc/eeprom/max6875.c
index 0e32709..fc0cf9a 100644
--- a/drivers/misc/eeprom/max6875.c
+++ b/drivers/misc/eeprom/max6875.c
@@ -148,7 +148,8 @@ static int max6875_probe(struct i2c_client *client,
if (client->addr & 1)
return -ENODEV;
 
-   if (!(data = kzalloc(sizeof(struct max6875_data), GFP_KERNEL)))
+   data = kzalloc(sizeof(struct max6875_data), GFP_KERNEL);
+   if (!data)
return -ENOMEM;
 
/* A fake client is created on the odd address */
-- 
2.7.4



[PATCH] misc: eeprom: assignment outside the if statement

2018-08-03 Thread Parth Y Shah
Assignment of any variable should be kept outside the if statement

Signed-off-by: Parth Y Shah 
---
 drivers/misc/eeprom/max6875.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/eeprom/max6875.c b/drivers/misc/eeprom/max6875.c
index 0e32709..fc0cf9a 100644
--- a/drivers/misc/eeprom/max6875.c
+++ b/drivers/misc/eeprom/max6875.c
@@ -148,7 +148,8 @@ static int max6875_probe(struct i2c_client *client,
if (client->addr & 1)
return -ENODEV;
 
-   if (!(data = kzalloc(sizeof(struct max6875_data), GFP_KERNEL)))
+   data = kzalloc(sizeof(struct max6875_data), GFP_KERNEL);
+   if (!data)
return -ENOMEM;
 
/* A fake client is created on the odd address */
-- 
2.7.4