* [PATCH] tty: serial/68328serial.c: remove unnecessary null pointer check
@ 2013-01-16 22:30 Cong Ding
2013-01-16 22:30 ` [PATCH] tty: serial/crisv10.c: " Cong Ding
0 siblings, 1 reply; 4+ messages in thread
From: Cong Ding @ 2013-01-16 22:30 UTC (permalink / raw)
To: Alan Cox, Greg Kroah-Hartman, Jiri Slaby, linux-serial,
linux-kernel
Cc: Cong Ding
The pointer info is dereferened in line 1009, so it is not necessary to check
null again in line 1012.
Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
drivers/tty/serial/68328serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/68328serial.c b/drivers/tty/serial/68328serial.c
index f99a845..4f7c0d2 100644
--- a/drivers/tty/serial/68328serial.c
+++ b/drivers/tty/serial/68328serial.c
@@ -1009,7 +1009,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
m68328_uart *uart = &uart_addr[info->line];
unsigned long flags;
- if (!info || serial_paranoia_check(info, tty->name, "rs_close"))
+ if (serial_paranoia_check(info, tty->name, "rs_close"))
return;
local_irq_save(flags);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] tty: serial/crisv10.c: remove unnecessary null pointer check
2013-01-16 22:30 [PATCH] tty: serial/68328serial.c: remove unnecessary null pointer check Cong Ding
@ 2013-01-16 22:30 ` Cong Ding
2013-01-18 13:38 ` Jesper Nilsson
0 siblings, 1 reply; 4+ messages in thread
From: Cong Ding @ 2013-01-16 22:30 UTC (permalink / raw)
To: Mikael Starvik, Jesper Nilsson, Alan Cox, Greg Kroah-Hartman,
Jiri Slaby, linux-cris-kernel, linux-serial, linux-kernel
Cc: Cong Ding
The pointer tty is dereferened in line 3135, so it is not necessary to check
null again in line 3140.
Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
drivers/tty/serial/crisv10.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index 35ee6a2..3b24965 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -3137,7 +3137,7 @@ static int rs_raw_write(struct tty_struct *tty,
/* first some sanity checks */
- if (!tty || !info->xmit.buf)
+ if (!info->xmit.buf)
return 0;
#ifdef SERIAL_DEBUG_DATA
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tty: serial/crisv10.c: remove unnecessary null pointer check
2013-01-16 22:30 ` [PATCH] tty: serial/crisv10.c: " Cong Ding
@ 2013-01-18 13:38 ` Jesper Nilsson
2013-01-20 10:14 ` Jiri Slaby
0 siblings, 1 reply; 4+ messages in thread
From: Jesper Nilsson @ 2013-01-18 13:38 UTC (permalink / raw)
To: Cong Ding
Cc: Mikael Starvik, Alan Cox, Greg Kroah-Hartman, Jiri Slaby,
linux-cris-kernel, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
On Wed, Jan 16, 2013 at 11:30:44PM +0100, Cong Ding wrote:
> The pointer tty is dereferened in line 3135, so it is not necessary to check
> null again in line 3140.
I don't know if we actually need to check the parameter tty from being null,
but when checking the rest of the file, most other functions don't check it.
In any case, gcc is quite likely to remove that check due to the
earlier dereference, so removing it is probably acceptable.
> Signed-off-by: Cong Ding <dinggnu@gmail.com>
Thanks, I'll take it in the CRIS tree.
/^JN - Jesper Nilsson
--
Jesper Nilsson -- jesper.nilsson@axis.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tty: serial/crisv10.c: remove unnecessary null pointer check
2013-01-18 13:38 ` Jesper Nilsson
@ 2013-01-20 10:14 ` Jiri Slaby
0 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2013-01-20 10:14 UTC (permalink / raw)
To: Jesper Nilsson
Cc: Cong Ding, Mikael Starvik, Alan Cox, Greg Kroah-Hartman,
linux-cris-kernel, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
On 01/18/2013 02:38 PM, Jesper Nilsson wrote:
> On Wed, Jan 16, 2013 at 11:30:44PM +0100, Cong Ding wrote:
>> The pointer tty is dereferened in line 3135, so it is not necessary to check
>> null again in line 3140.
>
> I don't know if we actually need to check the parameter tty from being null,
> but when checking the rest of the file, most other functions don't check it.
Yes, the check in unneeded.
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-20 10:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-16 22:30 [PATCH] tty: serial/68328serial.c: remove unnecessary null pointer check Cong Ding
2013-01-16 22:30 ` [PATCH] tty: serial/crisv10.c: " Cong Ding
2013-01-18 13:38 ` Jesper Nilsson
2013-01-20 10:14 ` Jiri Slaby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).