linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: wfx: simplify virt_addr_valid call
@ 2020-09-12 14:47 trix
  2020-09-16 11:11 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: trix @ 2020-09-12 14:47 UTC (permalink / raw)
  To: jerome.pouiller, gregkh; +Cc: devel, linux-kernel, Tom Rix

From: Tom Rix <trix@redhat.com>

Reviewing sram_write_dma_safe(), there are two
identical calls to virt_addr_valid().  The second
call can be simplified by a comparison of variables
set from the first call.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/staging/wfx/fwio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c
index 22d3b684f04f..c99adb0c99f1 100644
--- a/drivers/staging/wfx/fwio.c
+++ b/drivers/staging/wfx/fwio.c
@@ -94,7 +94,7 @@ static int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf,
 		tmp = buf;
 	}
 	ret = sram_buf_write(wdev, addr, tmp, len);
-	if (!virt_addr_valid(buf))
+	if (tmp != buf)
 		kfree(tmp);
 	return ret;
 }
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: wfx: simplify virt_addr_valid call
  2020-09-12 14:47 [PATCH] staging: wfx: simplify virt_addr_valid call trix
@ 2020-09-16 11:11 ` Greg KH
  2020-09-16 12:22   ` Jérôme Pouiller
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2020-09-16 11:11 UTC (permalink / raw)
  To: trix; +Cc: jerome.pouiller, devel, linux-kernel

On Sat, Sep 12, 2020 at 07:47:19AM -0700, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> Reviewing sram_write_dma_safe(), there are two
> identical calls to virt_addr_valid().  The second
> call can be simplified by a comparison of variables
> set from the first call.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  drivers/staging/wfx/fwio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c
> index 22d3b684f04f..c99adb0c99f1 100644
> --- a/drivers/staging/wfx/fwio.c
> +++ b/drivers/staging/wfx/fwio.c
> @@ -94,7 +94,7 @@ static int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf,
>  		tmp = buf;
>  	}
>  	ret = sram_buf_write(wdev, addr, tmp, len);
> -	if (!virt_addr_valid(buf))
> +	if (tmp != buf)
>  		kfree(tmp);
>  	return ret;
>  }

Jerome, any thoughts?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: wfx: simplify virt_addr_valid call
  2020-09-16 11:11 ` Greg KH
@ 2020-09-16 12:22   ` Jérôme Pouiller
  0 siblings, 0 replies; 3+ messages in thread
From: Jérôme Pouiller @ 2020-09-16 12:22 UTC (permalink / raw)
  To: trix, Greg KH; +Cc: devel, linux-kernel

On Wednesday 16 September 2020 13:11:59 CEST Greg KH wrote:
> On Sat, Sep 12, 2020 at 07:47:19AM -0700, trix@redhat.com wrote:
> > From: Tom Rix <trix@redhat.com>
> >
> > Reviewing sram_write_dma_safe(), there are two
> > identical calls to virt_addr_valid().  The second
> > call can be simplified by a comparison of variables
> > set from the first call.
> >
> > Signed-off-by: Tom Rix <trix@redhat.com>
> > ---
> >  drivers/staging/wfx/fwio.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c
> > index 22d3b684f04f..c99adb0c99f1 100644
> > --- a/drivers/staging/wfx/fwio.c
> > +++ b/drivers/staging/wfx/fwio.c
> > @@ -94,7 +94,7 @@ static int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf,
> >               tmp = buf;
> >       }
> >       ret = sram_buf_write(wdev, addr, tmp, len);
> > -     if (!virt_addr_valid(buf))
> > +     if (tmp != buf)
> >               kfree(tmp);
> >       return ret;
> >  }
> 
> Jerome, any thoughts?

Looks correct.

Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>

-- 
Jérôme Pouiller



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-16 20:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-12 14:47 [PATCH] staging: wfx: simplify virt_addr_valid call trix
2020-09-16 11:11 ` Greg KH
2020-09-16 12:22   ` Jérôme Pouiller

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).