2014-06-29 08:03:19

by Fabian Frédérick

[permalink] [raw]
Subject: [PATCH 1/1] iommu/fsl_pamu: Remove unnecessary null test before kfree

Fix checkpatch warning:
WARNING: kfree(NULL) is safe this check is probably not required

Cc: Joerg Roedel <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Fabian Frederick <[email protected]>
---
drivers/iommu/fsl_pamu_domain.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
index 93072ba..0009dff 100644
--- a/drivers/iommu/fsl_pamu_domain.c
+++ b/drivers/iommu/fsl_pamu_domain.c
@@ -1118,8 +1118,7 @@ static int fsl_pamu_set_windows(struct iommu_domain *domain, u32 w_count)
ret = pamu_set_domain_geometry(dma_domain, &domain->geometry,
((w_count > 1) ? w_count : 0));
if (!ret) {
- if (dma_domain->win_arr)
- kfree(dma_domain->win_arr);
+ kfree(dma_domain->win_arr);
dma_domain->win_arr = kzalloc(sizeof(struct dma_window) *
w_count, GFP_ATOMIC);
if (!dma_domain->win_arr) {
--
1.8.4.5


2014-06-29 11:17:23

by Varun Sethi

[permalink] [raw]
Subject: RE: [PATCH 1/1] iommu/fsl_pamu: Remove unnecessary null test before kfree



> -----Original Message-----
> From: [email protected] [mailto:iommu-
> [email protected]] On Behalf Of Fabian Frederick
> Sent: Sunday, June 29, 2014 1:31 PM
> To: [email protected]
> Cc: Fabian Frederick; Grant Likely; [email protected];
> [email protected]
> Subject: [PATCH 1/1] iommu/fsl_pamu: Remove unnecessary null test before
> kfree
>
> Fix checkpatch warning:
> WARNING: kfree(NULL) is safe this check is probably not required
>
> Cc: Joerg Roedel <[email protected]>
> Cc: Grant Likely <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Fabian Frederick <[email protected]>
> ---
> drivers/iommu/fsl_pamu_domain.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/fsl_pamu_domain.c
> b/drivers/iommu/fsl_pamu_domain.c index 93072ba..0009dff 100644
> --- a/drivers/iommu/fsl_pamu_domain.c
> +++ b/drivers/iommu/fsl_pamu_domain.c
> @@ -1118,8 +1118,7 @@ static int fsl_pamu_set_windows(struct iommu_domain
> *domain, u32 w_count)
> ret = pamu_set_domain_geometry(dma_domain, &domain->geometry,
> ((w_count > 1) ? w_count : 0));
> if (!ret) {
> - if (dma_domain->win_arr)
> - kfree(dma_domain->win_arr);
> + kfree(dma_domain->win_arr);
> dma_domain->win_arr = kzalloc(sizeof(struct dma_window) *
> w_count, GFP_ATOMIC);
> if (!dma_domain->win_arr) {

Acked-by: Varun Sethi <[email protected]>

2014-07-04 11:09:13

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH 1/1] iommu/fsl_pamu: Remove unnecessary null test before kfree

On Sun, Jun 29, 2014 at 10:01:26AM +0200, Fabian Frederick wrote:
> Fix checkpatch warning:
> WARNING: kfree(NULL) is safe this check is probably not required

Applied, thanks.