[PATCH 1/2] Staging: pi433: declare functions static

2017-07-18 Thread Joseph Wright
Declare functions static to fix sparse warnings:

warning: symbol 'pi433_receive' was not declared. Should it be static?
warning: symbol 'pi433_tx_thread' was not declared. Should it be static?

Signed-off-by: Joseph Wright <rjosephwri...@gmail.com>
---
 drivers/staging/pi433/pi433_if.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 1bc478a..46461b4 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -313,7 +313,7 @@ pi433_start_rx(struct pi433_device *dev)
 
 /*-*/
 
-int
+static int
 pi433_receive(void *data)
 {
struct pi433_device *dev = data;
@@ -463,7 +463,7 @@ pi433_receive(void *data)
return bytes_total;
 }
 
-int
+static int
 pi433_tx_thread(void *data)
 {
struct pi433_device *device = data;
-- 
2.9.3



[PATCH 2/2] Staging: pi433: check error after kthread_run()

2017-07-18 Thread Joseph Wright
Error should be checked with IS_ERR after calling kthread_run()
instead of comparing the returned pointer to an int.

Found by sparse warning:

incompatible types for operation (<)
left side has type struct task_struct *tx_task_struct
right side has type int

Signed-off-by: Joseph Wright <rjosephwri...@gmail.com>
---
 drivers/staging/pi433/pi433_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 46461b4..4f724a5 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -1152,7 +1152,7 @@ static int pi433_probe(struct spi_device *spi)
device->tx_task_struct = kthread_run(pi433_tx_thread,
 device,
 "pi433_tx_task");
-   if (device->tx_task_struct < 0)
+   if (IS_ERR(device->tx_task_struct))
{
dev_dbg(device->dev, "start of send thread failed");
goto send_thread_failed;
-- 
2.9.3



[PATCH 1/2] Staging: pi433: declare functions static

2017-07-18 Thread Joseph Wright
Declare functions static to fix sparse warnings:

warning: symbol 'pi433_receive' was not declared. Should it be static?
warning: symbol 'pi433_tx_thread' was not declared. Should it be static?

Signed-off-by: Joseph Wright 
---
 drivers/staging/pi433/pi433_if.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 1bc478a..46461b4 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -313,7 +313,7 @@ pi433_start_rx(struct pi433_device *dev)
 
 /*-*/
 
-int
+static int
 pi433_receive(void *data)
 {
struct pi433_device *dev = data;
@@ -463,7 +463,7 @@ pi433_receive(void *data)
return bytes_total;
 }
 
-int
+static int
 pi433_tx_thread(void *data)
 {
struct pi433_device *device = data;
-- 
2.9.3



[PATCH 2/2] Staging: pi433: check error after kthread_run()

2017-07-18 Thread Joseph Wright
Error should be checked with IS_ERR after calling kthread_run()
instead of comparing the returned pointer to an int.

Found by sparse warning:

incompatible types for operation (<)
left side has type struct task_struct *tx_task_struct
right side has type int

Signed-off-by: Joseph Wright 
---
 drivers/staging/pi433/pi433_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 46461b4..4f724a5 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -1152,7 +1152,7 @@ static int pi433_probe(struct spi_device *spi)
device->tx_task_struct = kthread_run(pi433_tx_thread,
 device,
 "pi433_tx_task");
-   if (device->tx_task_struct < 0)
+   if (IS_ERR(device->tx_task_struct))
{
dev_dbg(device->dev, "start of send thread failed");
goto send_thread_failed;
-- 
2.9.3



[PATCH 0/2] Staging: pi433: fix sparse warnings

2017-07-18 Thread Joseph Wright
Two patches included to fix warnings found with sparse.

Joseph Wright (2):
  Staging: pi433: declare functions static
  Staging: pi433: check error after kthread_run()

 drivers/staging/pi433/pi433_if.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.9.3



[PATCH 0/2] Staging: pi433: fix sparse warnings

2017-07-18 Thread Joseph Wright
Two patches included to fix warnings found with sparse.

Joseph Wright (2):
  Staging: pi433: declare functions static
  Staging: pi433: check error after kthread_run()

 drivers/staging/pi433/pi433_if.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.9.3



Re: [PATCH v3 1/1] Staging: android/ion: declare function static

2017-07-18 Thread Joseph Wright
On Tue, Jul 18, 2017 at 08:58:22AM +0200, Greg KH wrote:
> On Sat, Jul 15, 2017 at 11:43:05AM +0000, Joseph Wright wrote:
> > Declare private function static to fix sparse warning:
> > 
> > ion_cma_heap.c:109:5: warning: symbol '__ion_add_cma_heaps' \
> > was not declared. Should it be static?
> > 
> > Signed-off-by: Joseph Wright <rjosephwri...@gmail.com>
> > ---
> > Changes in v3:
> >   - Make subject clearer
> > 
> >  drivers/staging/android/ion/ion_cma_heap.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Sorry, does not apply to my tree as I think someone else already did
> this before you did :(

Okay, thanks anyway.

Joseph


Re: [PATCH v3 1/1] Staging: android/ion: declare function static

2017-07-18 Thread Joseph Wright
On Tue, Jul 18, 2017 at 08:58:22AM +0200, Greg KH wrote:
> On Sat, Jul 15, 2017 at 11:43:05AM +0000, Joseph Wright wrote:
> > Declare private function static to fix sparse warning:
> > 
> > ion_cma_heap.c:109:5: warning: symbol '__ion_add_cma_heaps' \
> > was not declared. Should it be static?
> > 
> > Signed-off-by: Joseph Wright 
> > ---
> > Changes in v3:
> >   - Make subject clearer
> > 
> >  drivers/staging/android/ion/ion_cma_heap.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Sorry, does not apply to my tree as I think someone else already did
> this before you did :(

Okay, thanks anyway.

Joseph


[PATCH v3 1/1] Staging: android/ion: declare function static

2017-07-17 Thread Joseph Wright
Declare private function static to fix sparse warning:

ion_cma_heap.c:109:5: warning: symbol '__ion_add_cma_heaps' \
was not declared. Should it be static?

Signed-off-by: Joseph Wright <rjosephwri...@gmail.com>
---
Changes in v3:
  - Make subject clearer

 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index a0949bc..c6db9b7 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -106,7 +106,7 @@ static struct ion_heap *__ion_cma_heap_create(struct cma 
*cma)
return _heap->heap;
 }
 
-int __ion_add_cma_heaps(struct cma *cma, void *data)
+static int __ion_add_cma_heaps(struct cma *cma, void *data)
 {
struct ion_heap *heap;
 
-- 
2.9.3



[PATCH v3 1/1] Staging: android/ion: declare function static

2017-07-17 Thread Joseph Wright
Declare private function static to fix sparse warning:

ion_cma_heap.c:109:5: warning: symbol '__ion_add_cma_heaps' \
was not declared. Should it be static?

Signed-off-by: Joseph Wright 
---
Changes in v3:
  - Make subject clearer

 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index a0949bc..c6db9b7 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -106,7 +106,7 @@ static struct ion_heap *__ion_cma_heap_create(struct cma 
*cma)
return _heap->heap;
 }
 
-int __ion_add_cma_heaps(struct cma *cma, void *data)
+static int __ion_add_cma_heaps(struct cma *cma, void *data)
 {
struct ion_heap *heap;
 
-- 
2.9.3



[PATCH v3 0/1] Staging: android/ion: fix sparse warnings

2017-07-17 Thread Joseph Wright
Improve commit message.

Previous version included a patch to add declarations to ion.h, but I
have dropped that as the same declarations were recently removed.

Joseph Wright (1):
  Staging: android/ion: declare function static

 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.9.3



[PATCH v3 0/1] Staging: android/ion: fix sparse warnings

2017-07-17 Thread Joseph Wright
Improve commit message.

Previous version included a patch to add declarations to ion.h, but I
have dropped that as the same declarations were recently removed.

Joseph Wright (1):
  Staging: android/ion: declare function static

 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.9.3



[PATCH v2 2/2] Staging: android/ion: fix sparse warning

2017-07-11 Thread Joseph Wright
Declare private function static to fix sparse warning:

ion_cma_heap.c:109:5: warning: symbol '__ion_add_cma_heaps' \
was not declared. Should it be static?

Signed-off-by: Joseph Wright <rjosephwri...@gmail.com>
---
Changes in v2:
  - Split into multiple patches

 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index a0949bc..c6db9b7 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -106,7 +106,7 @@ static struct ion_heap *__ion_cma_heap_create(struct cma 
*cma)
return _heap->heap;
 }
 
-int __ion_add_cma_heaps(struct cma *cma, void *data)
+static int __ion_add_cma_heaps(struct cma *cma, void *data)
 {
struct ion_heap *heap;
 
-- 
2.9.3



[PATCH v2 2/2] Staging: android/ion: fix sparse warning

2017-07-11 Thread Joseph Wright
Declare private function static to fix sparse warning:

ion_cma_heap.c:109:5: warning: symbol '__ion_add_cma_heaps' \
was not declared. Should it be static?

Signed-off-by: Joseph Wright 
---
Changes in v2:
  - Split into multiple patches

 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index a0949bc..c6db9b7 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -106,7 +106,7 @@ static struct ion_heap *__ion_cma_heap_create(struct cma 
*cma)
return _heap->heap;
 }
 
-int __ion_add_cma_heaps(struct cma *cma, void *data)
+static int __ion_add_cma_heaps(struct cma *cma, void *data)
 {
struct ion_heap *heap;
 
-- 
2.9.3



[PATCH v2 0/2] Staging: android/ion: fix sparse warnings

2017-07-11 Thread Joseph Wright
Split sparse warning fixes into multiple patches.

Joseph Wright (2):
  Staging: android/ion: fix sparse warnings
  Staging: android/ion: fix sparse warning

 drivers/staging/android/ion/ion.h  | 4 
 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.9.3



[PATCH v2 0/2] Staging: android/ion: fix sparse warnings

2017-07-11 Thread Joseph Wright
Split sparse warning fixes into multiple patches.

Joseph Wright (2):
  Staging: android/ion: fix sparse warnings
  Staging: android/ion: fix sparse warning

 drivers/staging/android/ion/ion.h  | 4 
 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.9.3



[PATCH v2 1/2] Staging: android/ion: fix sparse warnings

2017-07-11 Thread Joseph Wright
Declare functions to fix sparse warnings:

ion_carveout_heap.c:115:17: warning: symbol 'ion_carveout_heap_create' \
was not declared. Should it be static?
ion_chunk_heap.c:120:17: warning: symbol 'ion_chunk_heap_create' \
was not declared. Should it be static?

Signed-off-by: Joseph Wright <rjosephwri...@gmail.com>
---
Changes in v2:
  - Split into multiple patches

 drivers/staging/android/ion/ion.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index fa9ed81..fda1e91 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -358,4 +358,8 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg);
 
 int ion_query_heaps(struct ion_heap_query *query);
 
+struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data);
+
+struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data);
+
 #endif /* _ION_H */
-- 
2.9.3



[PATCH v2 1/2] Staging: android/ion: fix sparse warnings

2017-07-11 Thread Joseph Wright
Declare functions to fix sparse warnings:

ion_carveout_heap.c:115:17: warning: symbol 'ion_carveout_heap_create' \
was not declared. Should it be static?
ion_chunk_heap.c:120:17: warning: symbol 'ion_chunk_heap_create' \
was not declared. Should it be static?

Signed-off-by: Joseph Wright 
---
Changes in v2:
  - Split into multiple patches

 drivers/staging/android/ion/ion.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index fa9ed81..fda1e91 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -358,4 +358,8 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg);
 
 int ion_query_heaps(struct ion_heap_query *query);
 
+struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data);
+
+struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data);
+
 #endif /* _ION_H */
-- 
2.9.3



[PATCH] Staging: android/ion: fix sparse warnings

2017-07-04 Thread Joseph Wright
ion_carveout_heap.c:115:17: warning: symbol 'ion_carveout_heap_create' \
was not declared. Should it be static?
ion_chunk_heap.c:120:17: warning: symbol 'ion_chunk_heap_create' \
was not declared. Should it be static?
ion_cma_heap.c:109:5: warning: symbol '__ion_add_cma_heaps' \
was not declared. Should it be static?

Signed-off-by: Joseph Wright <rjosephwri...@gmail.com>
---
 drivers/staging/android/ion/ion.h  | 4 
 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index fa9ed81..fda1e91 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -358,4 +358,8 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg);
 
 int ion_query_heaps(struct ion_heap_query *query);
 
+struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data);
+
+struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data);
+
 #endif /* _ION_H */
diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index a0949bc..c6db9b7 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -106,7 +106,7 @@ static struct ion_heap *__ion_cma_heap_create(struct cma 
*cma)
return _heap->heap;
 }
 
-int __ion_add_cma_heaps(struct cma *cma, void *data)
+static int __ion_add_cma_heaps(struct cma *cma, void *data)
 {
struct ion_heap *heap;
 
-- 
2.9.3



[PATCH] Staging: android/ion: fix sparse warnings

2017-07-04 Thread Joseph Wright
ion_carveout_heap.c:115:17: warning: symbol 'ion_carveout_heap_create' \
was not declared. Should it be static?
ion_chunk_heap.c:120:17: warning: symbol 'ion_chunk_heap_create' \
was not declared. Should it be static?
ion_cma_heap.c:109:5: warning: symbol '__ion_add_cma_heaps' \
was not declared. Should it be static?

Signed-off-by: Joseph Wright 
---
 drivers/staging/android/ion/ion.h  | 4 
 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index fa9ed81..fda1e91 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -358,4 +358,8 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg);
 
 int ion_query_heaps(struct ion_heap_query *query);
 
+struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data);
+
+struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data);
+
 #endif /* _ION_H */
diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index a0949bc..c6db9b7 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -106,7 +106,7 @@ static struct ion_heap *__ion_cma_heap_create(struct cma 
*cma)
return _heap->heap;
 }
 
-int __ion_add_cma_heaps(struct cma *cma, void *data)
+static int __ion_add_cma_heaps(struct cma *cma, void *data)
 {
struct ion_heap *heap;
 
-- 
2.9.3