2021-12-06 01:45:05

by 赵军奎

[permalink] [raw]
Subject: [PATCH] sound/core: remove useless NULL check before kfree

Tis patch try to remove useless NULL check before kfree

Signed-off-by: Bernard Zhao <[email protected]>
---
sound/core/info_oss.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/core/info_oss.c b/sound/core/info_oss.c
index 1ba887c7954e..ebc714b2f46b 100644
--- a/sound/core/info_oss.c
+++ b/sound/core/info_oss.c
@@ -32,10 +32,8 @@ int snd_oss_info_register(int dev, int num, char *string)
mutex_lock(&strings);
if (string == NULL) {
x = snd_sndstat_strings[num][dev];
- if (x) {
- kfree(x);
- x = NULL;
- }
+ kfree(x);
+ x = NULL;
} else {
x = kstrdup(string, GFP_KERNEL);
if (x == NULL) {
--
2.33.1



2021-12-06 09:08:45

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH] sound/core: remove useless NULL check before kfree

On Mon, 06 Dec 2021 02:40:46 +0100,
Bernard Zhao wrote:
>
> Tis patch try to remove useless NULL check before kfree
>
> Signed-off-by: Bernard Zhao <[email protected]>

Thanks, applied now (with the correction of the subject prefix).


Takashi