All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: media: atomisp: Remove useless cast.
       [not found] <cover.1488944614.git.varshar186@gmail.com>
@ 2017-03-08  3:53 ` Varsha Rao
  2017-03-08  9:16   ` [Outreachy kernel] " Julia Lawall
  2017-03-08  3:55 ` [PATCH 2/2] staging: media: atomisp: Remove unnecessary identifier Varsha Rao
  1 sibling, 1 reply; 8+ messages in thread
From: Varsha Rao @ 2017-03-08  3:53 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Greg Kroah-Hartman; +Cc: outreachy-kernel

Explicit type casting of variable, with same type as that of variable,
is not required. The following coccinelle script is used to remove it.

@@
type T;
T *ptr,p;
@@
(
- (T *)(&p)
+ &p
|
- (T *)ptr
+ ptr
|
- (T *)(ptr)
+ ptr
|
- (T)(p)
+ p
)

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
 drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c    | 2 +-
 drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c | 2 +-
 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c           | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
index f39d6f5..0bb6fa0 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
@@ -1335,7 +1335,7 @@ static int pc_monitoring(void *data)
 {
 	int i = 0;
 
-	(void)data;
+	data;
 	while (true) {
 		if (sh_binary_running) {
 			sh_css_metrics_sample_pcs();
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c
index 00b2d16..e274950 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c
@@ -1155,7 +1155,7 @@ sp_init_stage(struct ia_css_pipeline_stage *stage,
 	}
 
 	err = sh_css_sp_init_stage(binary,
-			     (const char *)binary_name,
+			     binary_name,
 			     blob_info,
 			     args,
 			     pipe_num,
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
index 358d340..a32c981 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
@@ -553,7 +553,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
 		vptr = hmm_bo_vmap(bo, true);
 		if (vptr) {
 			vptr = vptr + (virt - bo->start);
-			memset((void *)vptr, c, bytes);
+			memset(vptr, c, bytes);
 			clflush_cache_range(vptr, bytes);
 			hmm_bo_vunmap(bo);
 			return 0;
-- 
2.9.3



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

* [PATCH 2/2] staging: media: atomisp: Remove unnecessary identifier.
       [not found] <cover.1488944614.git.varshar186@gmail.com>
  2017-03-08  3:53 ` [PATCH 1/2] staging: media: atomisp: Remove useless cast Varsha Rao
@ 2017-03-08  3:55 ` Varsha Rao
  1 sibling, 0 replies; 8+ messages in thread
From: Varsha Rao @ 2017-03-08  3:55 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Greg Kroah-Hartman; +Cc: outreachy-kernel

This patch removes indentifier data, which is not required.

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
 drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
index 0bb6fa0..b575365 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
@@ -1335,7 +1335,6 @@ static int pc_monitoring(void *data)
 {
 	int i = 0;
 
-	data;
 	while (true) {
 		if (sh_binary_running) {
 			sh_css_metrics_sample_pcs();
-- 
2.9.3



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

* Re: [Outreachy kernel] [PATCH 1/2] staging: media: atomisp: Remove useless cast.
  2017-03-08  3:53 ` [PATCH 1/2] staging: media: atomisp: Remove useless cast Varsha Rao
@ 2017-03-08  9:16   ` Julia Lawall
  2017-03-09 10:55     ` Varsha Rao
  0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2017-03-08  9:16 UTC (permalink / raw)
  To: Varsha Rao; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, outreachy-kernel

y

On Wed, 8 Mar 2017, Varsha Rao wrote:

> Explicit type casting of variable, with same type as that of variable,
> is not required. The following coccinelle script is used to remove it.
>
> @@
> type T;
> T *ptr,p;
> @@
> (
> - (T *)(&p)
> + &p
> |
> - (T *)ptr
> + ptr
> |
> - (T *)(ptr)
> + ptr
> |
> - (T)(p)
> + p
> )
>
> Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
> ---
>  drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c    | 2 +-
>  drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c | 2 +-
>  drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c           | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
> index f39d6f5..0bb6fa0 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
> @@ -1335,7 +1335,7 @@ static int pc_monitoring(void *data)
>  {
>  	int i = 0;
>
> -	(void)data;
> +	data;

Did Coccinelle really find this case for you?  Because void and void * are
not the same.

julia

>  	while (true) {
>  		if (sh_binary_running) {
>  			sh_css_metrics_sample_pcs();
> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c
> index 00b2d16..e274950 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c
> @@ -1155,7 +1155,7 @@ sp_init_stage(struct ia_css_pipeline_stage *stage,
>  	}
>
>  	err = sh_css_sp_init_stage(binary,
> -			     (const char *)binary_name,
> +			     binary_name,
>  			     blob_info,
>  			     args,
>  			     pipe_num,
> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
> index 358d340..a32c981 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
> @@ -553,7 +553,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
>  		vptr = hmm_bo_vmap(bo, true);
>  		if (vptr) {
>  			vptr = vptr + (virt - bo->start);
> -			memset((void *)vptr, c, bytes);
> +			memset(vptr, c, bytes);
>  			clflush_cache_range(vptr, bytes);
>  			hmm_bo_vunmap(bo);
>  			return 0;
> --
> 2.9.3
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/58bf8051.081a620a.e7433.8064%40mx.google.com.
> For more options, visit https://groups.google.com/d/optout.
>


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

* Re: [Outreachy kernel] [PATCH 1/2] staging: media: atomisp: Remove useless cast.
  2017-03-08  9:16   ` [Outreachy kernel] " Julia Lawall
@ 2017-03-09 10:55     ` Varsha Rao
  2017-03-09 11:05       ` Julia Lawall
  0 siblings, 1 reply; 8+ messages in thread
From: Varsha Rao @ 2017-03-09 10:55 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: rvarsha016, mchehab, gregkh


[-- Attachment #1.1: Type: text/plain, Size: 1342 bytes --]


Hello,

Did Coccinelle really find this case for you?  Because void and void * are 
> not the same. 
>
>    Yes, it was found using Coccinelle. I got the output as following.

   diff -u -p a/media/atomisp/pci/atomisp2/css2400/sh_css.c 
b/media/atomisp/pci/atomisp2/css2400/sh_css.c
--- a/media/atomisp/pci/atomisp2/css2400/sh_css.c
+++ b/media/atomisp/pci/atomisp2/css2400/sh_css.c
@@ -1335,7 +1335,7 @@ static int pc_monitoring(void *data)
 {
        int i = 0;

-       (void)data;
+       data;
        while (true) {
                if (sh_binary_running) {
                        sh_css_metrics_sample_pcs();
 
 @@
type T;    //Here if we assume T to be type void
T *ptr,p;  //ptr is pointer to void and p is of type void.
@@

As you said void and void * are different.
(
- (T *)(&p)
+ &p
|
- (T *)ptr
+ ptr
|
- (T *)(ptr)
+ ptr
|
- (T)(p)   It is taking this case. 
+ p
)

But p and ptr are also different, then why is it considering p? Is it 
giving false positive?
To  check this, I just changed the declaration.

@@
type T;
T *ptr;
T p;
@@
(
- (T *)(&p)
+ &p
|
- (T *)ptr
+ ptr
|
- (T *)(ptr)
+ ptr
|
- (T)(p)
+ p
)

However, here it does not match void and void * . Also gives no output for 
this particular file.
Why is it not recognizing the difference between ptr and p ? (with the 
earlier coccinelle script)

Thanks,
Varsha

[-- Attachment #1.2: Type: text/html, Size: 1808 bytes --]

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

* Re: [Outreachy kernel] [PATCH 1/2] staging: media: atomisp: Remove useless cast.
  2017-03-09 10:55     ` Varsha Rao
@ 2017-03-09 11:05       ` Julia Lawall
  2017-03-09 11:37         ` Varsha Rao
  0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2017-03-09 11:05 UTC (permalink / raw)
  To: Varsha Rao; +Cc: outreachy-kernel, mchehab, gregkh

[-- Attachment #1: Type: text/plain, Size: 2486 bytes --]



On Thu, 9 Mar 2017, Varsha Rao wrote:

>
> Hello,
>
>       Did Coccinelle really find this case for you?  Because void and void * are
>       not the same.
>
>    Yes, it was found using Coccinelle. I got the output as following.
>
>    diff -u -p a/media/atomisp/pci/atomisp2/css2400/sh_css.c b/media/atomisp/pci/atomisp2/css2400/sh_css.c
> --- a/media/atomisp/pci/atomisp2/css2400/sh_css.c
> +++ b/media/atomisp/pci/atomisp2/css2400/sh_css.c
> @@ -1335,7 +1335,7 @@ static int pc_monitoring(void *data)
>  {
>         int i = 0;
>
> -       (void)data;
> +       data;
>         while (true) {
>                 if (sh_binary_running) {
>                         sh_css_metrics_sample_pcs();
>  
>  @@
> type T;    //Here if we assume T to be type void
> T *ptr,p;  //ptr is pointer to void and p is of type void.
> @@
>
> As you said void and void * are different.
> (
> - (T *)(&p)
> + &p
> |
> - (T *)ptr
> + ptr
> |
> - (T *)(ptr)
> + ptr
> |
> - (T)(p)   It is taking this case.
> + p
> )
>
> But p and ptr are also different, then why is it considering p? Is it giving false positive?
> To  check this, I just changed the declaration.
>
> @@
> type T;
> T *ptr;
> T p;
> @@
> (
> - (T *)(&p)
> + &p
> |
> - (T *)ptr
> + ptr
> |
> - (T *)(ptr)
> + ptr
> |
> - (T)(p)
> + p
> )
>
> However, here it does not match void and void * . Also gives no output for this particular file.
> Why is it not recognizing the difference between ptr and p ? (with the earlier coccinelle script)

Because there is a bug in the parsing of metavariable identifiers.  I knew
this, but haven't thought about it recently...  I think that once it sees
a *, it applies the * to everything that comes after.  Or more likely, it
is probably parsing the metavariables as T * being the type, and the list
of names coming after.

I'll make a note to fix it.

thanks,
julia


>
> Thanks,
> Varsha
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/53167cf4-2fc5-4178-b963-c616822ae3b1%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

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

* Re: [Outreachy kernel] [PATCH 1/2] staging: media: atomisp: Remove useless cast.
  2017-03-09 11:05       ` Julia Lawall
@ 2017-03-09 11:37         ` Varsha Rao
  2017-03-09 12:43           ` Julia Lawall
  0 siblings, 1 reply; 8+ messages in thread
From: Varsha Rao @ 2017-03-09 11:37 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: rvarsha016, mchehab, gregkh


[-- Attachment #1.1: Type: text/plain, Size: 1150 bytes --]


Hello,

> However, here it does not match void and void * . Also gives no output 
> for this particular file. 
> > Why is it not recognizing the difference between ptr and p ? (with the 
> earlier coccinelle script) 
>
> Because there is a bug in the parsing of metavariable identifiers.  I knew 
> this, but haven't thought about it recently...  I think that once it sees 
> a *, it applies the * to everything that comes after.  Or more likely, it 
> is probably parsing the metavariables as T * being the type, and the list 
> of names coming after. 
>
> I'll make a note to fix it. 
>
>
  Yes, it is indeed a bug and thanks for considering it. I hope the 
following observation would be of help.

  There was one more case, which I ignored as it gave false result. (using 
the first script)
  Such as it could not recognize difference between declaration unsigned 
int __user *user_chanlist and cast (unsigned int __force *)user_chanlist .
  Removed the later casting. The file is comedi/comedi_fops.c

  -               cmd.chanlist = (unsigned int __force *)user_chanlist;
  +               cmd.chanlist = user_chanlist;

   Thanks,
   Varsha

[-- Attachment #1.2: Type: text/html, Size: 1431 bytes --]

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

* Re: [Outreachy kernel] [PATCH 1/2] staging: media: atomisp: Remove useless cast.
  2017-03-09 11:37         ` Varsha Rao
@ 2017-03-09 12:43           ` Julia Lawall
  0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2017-03-09 12:43 UTC (permalink / raw)
  To: Varsha Rao; +Cc: outreachy-kernel, mchehab, gregkh

[-- Attachment #1: Type: text/plain, Size: 2017 bytes --]



On Thu, 9 Mar 2017, Varsha Rao wrote:

>
> Hello,
>
>       > However, here it does not match void and void * . Also gives
>       no output for this particular file.
>       > Why is it not recognizing the difference between ptr and p ?
>       (with the earlier coccinelle script)
>
>       Because there is a bug in the parsing of metavariable
>       identifiers.  I knew
>       this, but haven't thought about it recently...  I think that
>       once it sees
>       a *, it applies the * to everything that comes after.  Or more
>       likely, it
>       is probably parsing the metavariables as T * being the type, and
>       the list
>       of names coming after.
>
>       I'll make a note to fix it.
>
>
>   Yes, it is indeed a bug and thanks for considering it. I hope the
> following observation would be of help.
>
>   There was one more case, which I ignored as it gave false result. (using
> the first script)
>   Such as it could not recognize difference between declaration unsigned int
> __user *user_chanlist and cast (unsigned int __force *)user_chanlist .
>   Removed the later casting. The file is comedi/comedi_fops.c
>
>   -               cmd.chanlist = (unsigned int __force *)user_chanlist;
>   +               cmd.chanlist = user_chanlist;

Yeah, Coccinelle is also not good at annotations at the moment - work in
progress...  It was good thinking to ignore this case.

julia


>
>    Thanks,
>    Varsha
>
> --
> You received this message because you are subscribed to the Google Groups
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/c301a39d-7f44-4c3e-8f6c-
> 2350b5938d1b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

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

* [PATCH 1/2] staging: media: atomisp: Remove useless cast.
       [not found] <cover.1489069491.git.varshar186@gmail.com>
@ 2017-03-09 14:46 ` Varsha Rao
  0 siblings, 0 replies; 8+ messages in thread
From: Varsha Rao @ 2017-03-09 14:46 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Greg Kroah-Hartman; +Cc: outreachy-kernel

Explicit type casting of variable, with same type as that of variable,
is not required. The following coccinelle script is used to remove it.

@@
type T;
T *ptr;
T p;
@@
(
- (T *)(&p)
+ &p
|
- (T *)ptr
+ ptr
|
- (T *)(ptr)
+ ptr
|
- (T)(p)
+ p
)

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
 drivers/staging/media/atomisp/i2c/gc2235.c               | 16 ++++++++--------
 drivers/staging/media/atomisp/i2c/mt9m114.c              |  4 ++--
 drivers/staging/media/atomisp/i2c/ov2722.c               |  6 +++---
 .../atomisp2/css2400/runtime/isys/src/isys_dma_rmgr.c    |  2 +-
 .../media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c |  8 ++++----
 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c     |  2 +-
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/gc2235.c b/drivers/staging/media/atomisp/i2c/gc2235.c
index 37a83c7..0c3fa70 100644
--- a/drivers/staging/media/atomisp/i2c/gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/gc2235.c
@@ -278,7 +278,7 @@ static int gc2235_get_intg_factor(struct i2c_client *client,
 	if (ret)
 		return ret;
 
-	buf->crop_horizontal_start = ((u16)reg_val_h << 8) | (u16)reg_val;
+	buf->crop_horizontal_start = (reg_val_h << 8) | reg_val;
 
 	ret =  gc2235_read_reg(client, GC2235_8BIT,
 					GC2235_V_CROP_START_H, &reg_val_h);
@@ -287,7 +287,7 @@ static int gc2235_get_intg_factor(struct i2c_client *client,
 	if (ret)
 		return ret;
 
-	buf->crop_vertical_start = ((u16)reg_val_h << 8) | (u16)reg_val;
+	buf->crop_vertical_start = (reg_val_h << 8) | reg_val;
 
 	ret = gc2235_read_reg(client, GC2235_8BIT,
 					GC2235_H_OUTSIZE_H, &reg_val_h);
@@ -295,7 +295,7 @@ static int gc2235_get_intg_factor(struct i2c_client *client,
 					GC2235_H_OUTSIZE_L, &reg_val);
 	if (ret)
 		return ret;
-	buf->output_width = ((u16)reg_val_h << 8) | (u16)reg_val;
+	buf->output_width = (reg_val_h << 8) | reg_val;
 
 	ret = gc2235_read_reg(client, GC2235_8BIT,
 					GC2235_V_OUTSIZE_H, &reg_val_h);
@@ -303,7 +303,7 @@ static int gc2235_get_intg_factor(struct i2c_client *client,
 					GC2235_V_OUTSIZE_L, &reg_val);
 	if (ret)
 		return ret;
-	buf->output_height = ((u16)reg_val_h << 8) | (u16)reg_val;
+	buf->output_height = (reg_val_h << 8) | reg_val;
 
 	buf->crop_horizontal_end = buf->crop_horizontal_start +
 						buf->output_width - 1;
@@ -317,7 +317,7 @@ static int gc2235_get_intg_factor(struct i2c_client *client,
 	if (ret)
 		return ret;
 
-	dummy = ((u16)reg_val_h << 8) | (u16)reg_val;
+	dummy = (reg_val_h << 8) | reg_val;
 
 	ret = gc2235_read_reg(client, GC2235_8BIT,
 					GC2235_SH_DELAY_H, &reg_val_h);
@@ -702,9 +702,9 @@ static int distance(struct gc2235_resolution *res, u32 w, u32 h)
 	h_ratio = (res->height << 13) / h;
 	if (h_ratio == 0)
 		return -1;
-	match   = abs(((w_ratio << 13) / h_ratio) - ((int)8192));
+	match   = abs(((w_ratio << 13) / h_ratio) - (8192));
 
-	if ((w_ratio < (int)8192) || (h_ratio < (int)8192)  ||
+	if ((w_ratio < 8192) || (h_ratio < 8192)  ||
 		(match > LARGEST_ALLOWED_RATIO_MISMATCH))
 		return -1;
 
@@ -873,7 +873,7 @@ static int gc2235_detect(struct i2c_client *client)
 	}
 	ret = gc2235_read_reg(client, GC2235_8BIT,
 					GC2235_SENSOR_ID_L, &low);
-	id = ((((u16) high) << 8) | (u16) low);
+	id = (((high) << 8) | low);
 
 	if (id != GC2235_ID) {
 		dev_err(&client->dev, "sensor ID error, 0x%x\n", id);
diff --git a/drivers/staging/media/atomisp/i2c/mt9m114.c b/drivers/staging/media/atomisp/i2c/mt9m114.c
index 8762124..514b112 100644
--- a/drivers/staging/media/atomisp/i2c/mt9m114.c
+++ b/drivers/staging/media/atomisp/i2c/mt9m114.c
@@ -618,9 +618,9 @@ static int distance(struct mt9m114_res_struct const *res, u32 w, u32 h)
 	h_ratio = (res->height << 13) / h;
 	if (h_ratio == 0)
 		return -1;
-	match   = abs(((w_ratio << 13) / h_ratio) - ((int)8192));
+	match   = abs(((w_ratio << 13) / h_ratio) - (8192));
 
-	if ((w_ratio < (int)8192) || (h_ratio < (int)8192)  ||
+	if ((w_ratio < 8192) || (h_ratio < 8192)  ||
 		(match > LARGEST_ALLOWED_RATIO_MISMATCH))
 		return -1;
 
diff --git a/drivers/staging/media/atomisp/i2c/ov2722.c b/drivers/staging/media/atomisp/i2c/ov2722.c
index 43e872a..f615898 100644
--- a/drivers/staging/media/atomisp/i2c/ov2722.c
+++ b/drivers/staging/media/atomisp/i2c/ov2722.c
@@ -807,9 +807,9 @@ static int distance(struct ov2722_resolution *res, u32 w, u32 h)
 	h_ratio = (res->height << 13) / h;
 	if (h_ratio == 0)
 		return -1;
-	match   = abs(((w_ratio << 13) / h_ratio) - ((int)8192));
+	match   = abs(((w_ratio << 13) / h_ratio) - (8192));
 
-	if ((w_ratio < (int)8192) || (h_ratio < (int)8192)  ||
+	if ((w_ratio < 8192) || (h_ratio < 8192)  ||
 		(match > LARGEST_ALLOWED_RATIO_MISMATCH))
 		return -1;
 
@@ -998,7 +998,7 @@ static int ov2722_detect(struct i2c_client *client)
 	}
 	ret = ov2722_read_reg(client, OV2722_8BIT,
 					OV2722_SC_CMMN_CHIP_ID_L, &low);
-	id = ((((u16) high) << 8) | (u16) low);
+	id = (((high) << 8) | low);
 
 	if ((id != OV2722_ID) && (id != OV2720_ID)) {
 		dev_err(&client->dev, "sensor ID error\n");
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_dma_rmgr.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_dma_rmgr.c
index d99150a..5032627 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_dma_rmgr.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_dma_rmgr.c
@@ -69,7 +69,7 @@ bool ia_css_isys_dma_channel_rmgr_acquire(
 		for (i = ISYS2401_DMA_CHANNEL_0; i < N_ISYS2401_DMA_CHANNEL; i++) {
 			if (bitop_getbit(cur_rsrc->active_table, i) == 0) {
 				bitop_setbit(cur_rsrc->active_table, i);
-				*channel = (isys2401_dma_channel)i;
+				*channel = i;
 				cur_rsrc->num_active++;
 				retval = true;
 				break;
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
index eba96cc..b294e6d 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
@@ -122,7 +122,7 @@ sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi, struct ia
 	/* Special case: only one binary in fw */
 	if (bi == NULL) bi = (const struct ia_css_fw_info *)fw;
 
-	name = (const char *)fw + bi->blob.prog_name_offset;
+	name = fw + bi->blob.prog_name_offset;
 	blob = (const unsigned char *)fw + bi->blob.offset;
 
 	/* sanity check */
@@ -201,7 +201,7 @@ sh_css_check_firmware_version(const char *fw_data)
 	struct sh_css_fw_bi_file_h *file_header;
 
 	firmware_header = (struct firmware_header *)fw_data;
-	file_header = (struct sh_css_fw_bi_file_h *)&firmware_header->file_header;
+	file_header = &firmware_header->file_header;
 
 	if (strcmp(file_header->version, release_version) != 0) {
 		return false;
@@ -221,8 +221,8 @@ sh_css_load_firmware(const char *fw_data,
 	bool valid_firmware = false;
 
 	firmware_header = (struct firmware_header *)fw_data;
-	file_header = (struct sh_css_fw_bi_file_h *)&firmware_header->file_header;
-	binaries = (struct ia_css_fw_info *)&firmware_header->binary_header;
+	file_header = &firmware_header->file_header;
+	binaries = &firmware_header->binary_header;
 	strncpy(FW_rel_ver_name, file_header->version, min(sizeof(FW_rel_ver_name), sizeof(file_header->version)) - 1);
 	valid_firmware = sh_css_check_firmware_version(fw_data);
 	if (!valid_firmware) {
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
index 358d340..a32c981 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
@@ -553,7 +553,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
 		vptr = hmm_bo_vmap(bo, true);
 		if (vptr) {
 			vptr = vptr + (virt - bo->start);
-			memset((void *)vptr, c, bytes);
+			memset(vptr, c, bytes);
 			clflush_cache_range(vptr, bytes);
 			hmm_bo_vunmap(bo);
 			return 0;
-- 
2.9.3



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

end of thread, other threads:[~2017-03-09 14:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1488944614.git.varshar186@gmail.com>
2017-03-08  3:53 ` [PATCH 1/2] staging: media: atomisp: Remove useless cast Varsha Rao
2017-03-08  9:16   ` [Outreachy kernel] " Julia Lawall
2017-03-09 10:55     ` Varsha Rao
2017-03-09 11:05       ` Julia Lawall
2017-03-09 11:37         ` Varsha Rao
2017-03-09 12:43           ` Julia Lawall
2017-03-08  3:55 ` [PATCH 2/2] staging: media: atomisp: Remove unnecessary identifier Varsha Rao
     [not found] <cover.1489069491.git.varshar186@gmail.com>
2017-03-09 14:46 ` [PATCH 1/2] staging: media: atomisp: Remove useless cast Varsha Rao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.