Commit fcfeef6c authored by Lidza Louina's avatar Lidza Louina Committed by Greg Kroah-Hartman

staging: dgap: tty.c: removes smatch warnings "redundant null check"

This patch removes these smatch warnings:
redundant null check on dgap_TmpWriteBuf calling kfree()
redundant null check on brd->SerialDriver->ttys calling kfree()
redundant null check on brd->PrintDriver->ttys calling kfree()

The code checked to see if these variables are null
before freeing. This check isn't needed.
Signed-off-by: default avatarLidza Louina <lidza.louina@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 913b6f8e
...@@ -497,10 +497,8 @@ int dgap_tty_init(struct board_t *brd) ...@@ -497,10 +497,8 @@ int dgap_tty_init(struct board_t *brd)
*/ */
void dgap_tty_post_uninit(void) void dgap_tty_post_uninit(void)
{ {
if (dgap_TmpWriteBuf) {
kfree(dgap_TmpWriteBuf); kfree(dgap_TmpWriteBuf);
dgap_TmpWriteBuf = NULL; dgap_TmpWriteBuf = NULL;
}
} }
...@@ -522,10 +520,8 @@ void dgap_tty_uninit(struct board_t *brd) ...@@ -522,10 +520,8 @@ void dgap_tty_uninit(struct board_t *brd)
tty_unregister_device(brd->SerialDriver, i); tty_unregister_device(brd->SerialDriver, i);
} }
tty_unregister_driver(brd->SerialDriver); tty_unregister_driver(brd->SerialDriver);
if (brd->SerialDriver->ttys) {
kfree(brd->SerialDriver->ttys); kfree(brd->SerialDriver->ttys);
brd->SerialDriver->ttys = NULL; brd->SerialDriver->ttys = NULL;
}
put_tty_driver(brd->SerialDriver); put_tty_driver(brd->SerialDriver);
brd->dgap_Major_Serial_Registered = FALSE; brd->dgap_Major_Serial_Registered = FALSE;
} }
...@@ -538,10 +534,8 @@ void dgap_tty_uninit(struct board_t *brd) ...@@ -538,10 +534,8 @@ void dgap_tty_uninit(struct board_t *brd)
tty_unregister_device(brd->PrintDriver, i); tty_unregister_device(brd->PrintDriver, i);
} }
tty_unregister_driver(brd->PrintDriver); tty_unregister_driver(brd->PrintDriver);
if (brd->PrintDriver->ttys) {
kfree(brd->PrintDriver->ttys); kfree(brd->PrintDriver->ttys);
brd->PrintDriver->ttys = NULL; brd->PrintDriver->ttys = NULL;
}
put_tty_driver(brd->PrintDriver); put_tty_driver(brd->PrintDriver);
brd->dgap_Major_TransparentPrint_Registered = FALSE; brd->dgap_Major_TransparentPrint_Registered = FALSE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment