All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: omap-serial: remove set but unused variable
@ 2019-12-05 12:04 Xiongfeng Wang
  2019-12-05 12:13 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Xiongfeng Wang @ 2019-12-05 12:04 UTC (permalink / raw)
  To: gregkh, jslaby; +Cc: linux-serial, linux-kernel, huawei.libin, wangxiongfeng2

Fix the following warning:
drivers/tty/serial/omap-serial.c: In function serial_omap_rlsi:
drivers/tty/serial/omap-serial.c:496:16: warning: variable ch set but not used [-Wunused-but-set-variable]

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
 drivers/tty/serial/omap-serial.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 6420ae5..54ee3ae 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -493,10 +493,9 @@ static unsigned int check_modem_status(struct uart_omap_port *up)
 static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr)
 {
 	unsigned int flag;
-	unsigned char ch = 0;
 
 	if (likely(lsr & UART_LSR_DR))
-		ch = serial_in(up, UART_RX);
+		serial_in(up, UART_RX);
 
 	up->port.icount.rx++;
 	flag = TTY_NORMAL;
-- 
1.7.12.4


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

* Re: [PATCH] tty: omap-serial: remove set but unused variable
  2019-12-05 12:04 [PATCH] tty: omap-serial: remove set but unused variable Xiongfeng Wang
@ 2019-12-05 12:13 ` Greg KH
  2019-12-05 12:30   ` Xiongfeng Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2019-12-05 12:13 UTC (permalink / raw)
  To: Xiongfeng Wang; +Cc: jslaby, linux-serial, linux-kernel, huawei.libin

On Thu, Dec 05, 2019 at 08:04:36PM +0800, Xiongfeng Wang wrote:
> Fix the following warning:
> drivers/tty/serial/omap-serial.c: In function serial_omap_rlsi:
> drivers/tty/serial/omap-serial.c:496:16: warning: variable ch set but not used [-Wunused-but-set-variable]
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
> ---
>  drivers/tty/serial/omap-serial.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
> index 6420ae5..54ee3ae 100644
> --- a/drivers/tty/serial/omap-serial.c
> +++ b/drivers/tty/serial/omap-serial.c
> @@ -493,10 +493,9 @@ static unsigned int check_modem_status(struct uart_omap_port *up)
>  static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr)
>  {
>  	unsigned int flag;
> -	unsigned char ch = 0;
>  
>  	if (likely(lsr & UART_LSR_DR))
> -		ch = serial_in(up, UART_RX);
> +		serial_in(up, UART_RX);

Shouldn't you be doing something with 'ch'?


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

* Re: [PATCH] tty: omap-serial: remove set but unused variable
  2019-12-05 12:13 ` Greg KH
@ 2019-12-05 12:30   ` Xiongfeng Wang
  2019-12-05 12:39     ` Jiri Slaby
  0 siblings, 1 reply; 6+ messages in thread
From: Xiongfeng Wang @ 2019-12-05 12:30 UTC (permalink / raw)
  To: Greg KH; +Cc: jslaby, linux-serial, linux-kernel, huawei.libin



On 2019/12/5 20:13, Greg KH wrote:
> On Thu, Dec 05, 2019 at 08:04:36PM +0800, Xiongfeng Wang wrote:
>> Fix the following warning:
>> drivers/tty/serial/omap-serial.c: In function serial_omap_rlsi:
>> drivers/tty/serial/omap-serial.c:496:16: warning: variable ch set but not used [-Wunused-but-set-variable]
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
>> ---
>>  drivers/tty/serial/omap-serial.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
>> index 6420ae5..54ee3ae 100644
>> --- a/drivers/tty/serial/omap-serial.c
>> +++ b/drivers/tty/serial/omap-serial.c
>> @@ -493,10 +493,9 @@ static unsigned int check_modem_status(struct uart_omap_port *up)
>>  static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr)
>>  {
>>  	unsigned int flag;
>> -	unsigned char ch = 0;
>>  
>>  	if (likely(lsr & UART_LSR_DR))
>> -		ch = serial_in(up, UART_RX);
>> +		serial_in(up, UART_RX);
> 
> Shouldn't you be doing something with 'ch'?

Sorry, my original thought is trying not to modify the existing logic.
I will look into the mechanism to see if I need to check 'ch'.

Thanks,
Xiongfeng

> 
> 
> .
> 


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

* Re: [PATCH] tty: omap-serial: remove set but unused variable
  2019-12-05 12:30   ` Xiongfeng Wang
@ 2019-12-05 12:39     ` Jiri Slaby
  2019-12-06  7:11       ` Xiongfeng Wang
  2019-12-06  7:38       ` Xiongfeng Wang
  0 siblings, 2 replies; 6+ messages in thread
From: Jiri Slaby @ 2019-12-05 12:39 UTC (permalink / raw)
  To: Xiongfeng Wang, Greg KH
  Cc: linux-serial, linux-kernel, huawei.libin, shubhrajyoti,
	balbi@ti.com >> Felipe Balbi

On 05. 12. 19, 13:30, Xiongfeng Wang wrote:
> 
> 
> On 2019/12/5 20:13, Greg KH wrote:
>> On Thu, Dec 05, 2019 at 08:04:36PM +0800, Xiongfeng Wang wrote:
>>> Fix the following warning:
>>> drivers/tty/serial/omap-serial.c: In function serial_omap_rlsi:
>>> drivers/tty/serial/omap-serial.c:496:16: warning: variable ch set but not used [-Wunused-but-set-variable]
>>>
>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
>>> ---
>>>  drivers/tty/serial/omap-serial.c | 3 +--
>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
>>> index 6420ae5..54ee3ae 100644
>>> --- a/drivers/tty/serial/omap-serial.c
>>> +++ b/drivers/tty/serial/omap-serial.c
>>> @@ -493,10 +493,9 @@ static unsigned int check_modem_status(struct uart_omap_port *up)
>>>  static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr)
>>>  {
>>>  	unsigned int flag;
>>> -	unsigned char ch = 0;
>>>  
>>>  	if (likely(lsr & UART_LSR_DR))
>>> -		ch = serial_in(up, UART_RX);
>>> +		serial_in(up, UART_RX);
>>
>> Shouldn't you be doing something with 'ch'?
> 
> Sorry, my original thought is trying not to modify the existing logic.
> I will look into the mechanism to see if I need to check 'ch'.

The change looks in fact correct, see:
commit 9a12fcf8b1543c99ffcec3d61db86f0dea52dc9d
Author: Shubhrajyoti D <shubhrajyoti@ti.com>
Date:   Fri Sep 21 20:07:19 2012 +0530

    serial: omap: fix the reciever line error case

It also says: "This is recommended in the interrupt reset method in the
table 23-246 of the omap4 TRM."

The character read is erroneous and should be apparently dropped. But
you should add a comment about it, though.

thanks,
-- 
js
suse labs

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

* Re: [PATCH] tty: omap-serial: remove set but unused variable
  2019-12-05 12:39     ` Jiri Slaby
@ 2019-12-06  7:11       ` Xiongfeng Wang
  2019-12-06  7:38       ` Xiongfeng Wang
  1 sibling, 0 replies; 6+ messages in thread
From: Xiongfeng Wang @ 2019-12-06  7:11 UTC (permalink / raw)
  To: Jiri Slaby, Greg KH
  Cc: linux-serial, linux-kernel, huawei.libin, shubhrajyoti,
	balbi@ti.com >> Felipe Balbi



On 2019/12/5 20:39, Jiri Slaby wrote:
> On 05. 12. 19, 13:30, Xiongfeng Wang wrote:
>>
>>
>> On 2019/12/5 20:13, Greg KH wrote:
>>> On Thu, Dec 05, 2019 at 08:04:36PM +0800, Xiongfeng Wang wrote:
>>>> Fix the following warning:
>>>> drivers/tty/serial/omap-serial.c: In function serial_omap_rlsi:
>>>> drivers/tty/serial/omap-serial.c:496:16: warning: variable ch set but not used [-Wunused-but-set-variable]
>>>>
>>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>>> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
>>>> ---
>>>>  drivers/tty/serial/omap-serial.c | 3 +--
>>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
>>>> index 6420ae5..54ee3ae 100644
>>>> --- a/drivers/tty/serial/omap-serial.c
>>>> +++ b/drivers/tty/serial/omap-serial.c
>>>> @@ -493,10 +493,9 @@ static unsigned int check_modem_status(struct uart_omap_port *up)
>>>>  static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr)
>>>>  {
>>>>  	unsigned int flag;
>>>> -	unsigned char ch = 0;
>>>>  
>>>>  	if (likely(lsr & UART_LSR_DR))
>>>> -		ch = serial_in(up, UART_RX);
>>>> +		serial_in(up, UART_RX);
>>>
>>> Shouldn't you be doing something with 'ch'?
>>
>> Sorry, my original thought is trying not to modify the existing logic.
>> I will look into the mechanism to see if I need to check 'ch'.
> 
> The change looks in fact correct, see:
> commit 9a12fcf8b1543c99ffcec3d61db86f0dea52dc9d
> Author: Shubhrajyoti D <shubhrajyoti@ti.com>
> Date:   Fri Sep 21 20:07:19 2012 +0530
> 
>     serial: omap: fix the reciever line error case
> 
> It also says: "This is recommended in the interrupt reset method in the
> table 23-246 of the omap4 TRM."
> 
> The character read is erroneous and should be apparently dropped. But
> you should add a comment about it, though.

Thanks a lot. I will add it in the comment and send another version.

Thanks,
Xiongfeng

> 
> thanks,
> 


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

* Re: [PATCH] tty: omap-serial: remove set but unused variable
  2019-12-05 12:39     ` Jiri Slaby
  2019-12-06  7:11       ` Xiongfeng Wang
@ 2019-12-06  7:38       ` Xiongfeng Wang
  1 sibling, 0 replies; 6+ messages in thread
From: Xiongfeng Wang @ 2019-12-06  7:38 UTC (permalink / raw)
  To: Jiri Slaby, Greg KH; +Cc: linux-serial, linux-kernel, huawei.libin



On 2019/12/5 20:39, Jiri Slaby wrote:
> On 05. 12. 19, 13:30, Xiongfeng Wang wrote:
>>
>>
>> On 2019/12/5 20:13, Greg KH wrote:
>>> On Thu, Dec 05, 2019 at 08:04:36PM +0800, Xiongfeng Wang wrote:
>>>> Fix the following warning:
>>>> drivers/tty/serial/omap-serial.c: In function serial_omap_rlsi:
>>>> drivers/tty/serial/omap-serial.c:496:16: warning: variable ch set but not used [-Wunused-but-set-variable]
>>>>
>>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>>> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
>>>> ---
>>>>  drivers/tty/serial/omap-serial.c | 3 +--
>>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
>>>> index 6420ae5..54ee3ae 100644
>>>> --- a/drivers/tty/serial/omap-serial.c
>>>> +++ b/drivers/tty/serial/omap-serial.c
>>>> @@ -493,10 +493,9 @@ static unsigned int check_modem_status(struct uart_omap_port *up)
>>>>  static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr)
>>>>  {
>>>>  	unsigned int flag;
>>>> -	unsigned char ch = 0;
>>>>  
>>>>  	if (likely(lsr & UART_LSR_DR))
>>>> -		ch = serial_in(up, UART_RX);
>>>> +		serial_in(up, UART_RX);
>>>
>>> Shouldn't you be doing something with 'ch'?
>>
>> Sorry, my original thought is trying not to modify the existing logic.
>> I will look into the mechanism to see if I need to check 'ch'.
> 
> The change looks in fact correct, see:
> commit 9a12fcf8b1543c99ffcec3d61db86f0dea52dc9d
> Author: Shubhrajyoti D <shubhrajyoti@ti.com>
> Date:   Fri Sep 21 20:07:19 2012 +0530
> 
>     serial: omap: fix the reciever line error case
> 
> It also says: "This is recommended in the interrupt reset method in the
> table 23-246 of the omap4 TRM."
> 
> The character read is erroneous and should be apparently dropped. But
> you should add a comment about it, though.
> 

Thanks a lot. I will add it in the comment and send another version.

Thanks,
Xiongfeng

> thanks,
> 


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

end of thread, other threads:[~2019-12-06  7:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-05 12:04 [PATCH] tty: omap-serial: remove set but unused variable Xiongfeng Wang
2019-12-05 12:13 ` Greg KH
2019-12-05 12:30   ` Xiongfeng Wang
2019-12-05 12:39     ` Jiri Slaby
2019-12-06  7:11       ` Xiongfeng Wang
2019-12-06  7:38       ` Xiongfeng Wang

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.