diff mbox

[1/2] mmc: Remove redundant null check before kfree in sdio_bus.c

Message ID 1353402797-6785-1-git-send-email-sachin.kamat@linaro.org
State Accepted
Headers show

Commit Message

Sachin Kamat Nov. 20, 2012, 9:13 a.m. UTC
kfree on a null pointer is a no-op.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/mmc/core/sdio_bus.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Comments

Sachin Kamat Nov. 26, 2012, 10:32 a.m. UTC | #1
Hi Chris

Any comments on these 2 patches?

On 20 November 2012 14:43, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> kfree on a null pointer is a no-op.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/mmc/core/sdio_bus.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
> index 6bf6879..fdcf9e3 100644
> --- a/drivers/mmc/core/sdio_bus.c
> +++ b/drivers/mmc/core/sdio_bus.c
> @@ -258,8 +258,7 @@ static void sdio_release_func(struct device *dev)
>
>         sdio_free_func_cis(func);
>
> -       if (func->info)
> -               kfree(func->info);
> +       kfree(func->info);
>
>         kfree(func);
>  }
> --
> 1.7.4.1
>
Sachin Kamat Dec. 3, 2012, 9:07 a.m. UTC | #2
On 20 November 2012 14:43, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> kfree on a null pointer is a no-op.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/mmc/core/sdio_bus.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
> index 6bf6879..fdcf9e3 100644
> --- a/drivers/mmc/core/sdio_bus.c
> +++ b/drivers/mmc/core/sdio_bus.c
> @@ -258,8 +258,7 @@ static void sdio_release_func(struct device *dev)
>
>         sdio_free_func_cis(func);
>
> -       if (func->info)
> -               kfree(func->info);
> +       kfree(func->info);
>
>         kfree(func);
>  }
> --
> 1.7.4.1
>

ping...
Chris Ball Dec. 3, 2012, 7:18 p.m. UTC | #3
Hi Sachin,

On Tue, Nov 20 2012, Sachin Kamat wrote:
> kfree on a null pointer is a no-op.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/mmc/core/sdio_bus.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
> index 6bf6879..fdcf9e3 100644
> --- a/drivers/mmc/core/sdio_bus.c
> +++ b/drivers/mmc/core/sdio_bus.c
> @@ -258,8 +258,7 @@ static void sdio_release_func(struct device *dev)
>  
>  	sdio_free_func_cis(func);
>  
> -	if (func->info)
> -		kfree(func->info);
> +	kfree(func->info);
>  
>  	kfree(func);
>  }

Thanks, pushed both patches to mmc-next for 3.8.

- Chris.
diff mbox

Patch

diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index 6bf6879..fdcf9e3 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -258,8 +258,7 @@  static void sdio_release_func(struct device *dev)
 
 	sdio_free_func_cis(func);
 
-	if (func->info)
-		kfree(func->info);
+	kfree(func->info);
 
 	kfree(func);
 }