diff mbox series

[-next] scsi: qedf: use vzalloc() instead of vmalloc()/memset(0)

Message ID 20210518132018.1312995-1-yangyingliang@huawei.com (mailing list archive)
State Accepted
Headers show
Series [-next] scsi: qedf: use vzalloc() instead of vmalloc()/memset(0) | expand

Commit Message

Yang Yingliang May 18, 2021, 1:20 p.m. UTC
Use vzalloc() instead of vmalloc() and memset(0) to simpify
the code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/scsi/qedf/qedf_dbg.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Himanshu Madhani May 18, 2021, 3:52 p.m. UTC | #1
On 5/18/21 8:20 AM, Yang Yingliang wrote:
> Use vzalloc() instead of vmalloc() and memset(0) to simpify
> the code.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>   drivers/scsi/qedf/qedf_dbg.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/qedf/qedf_dbg.c b/drivers/scsi/qedf/qedf_dbg.c
> index e0387e495261..0d2aed82882a 100644
> --- a/drivers/scsi/qedf/qedf_dbg.c
> +++ b/drivers/scsi/qedf/qedf_dbg.c
> @@ -106,11 +106,10 @@ qedf_dbg_info(struct qedf_dbg_ctx *qedf, const char *func, u32 line,
>   int
>   qedf_alloc_grc_dump_buf(u8 **buf, uint32_t len)
>   {
> -		*buf = vmalloc(len);
> +		*buf = vzalloc(len);
>   		if (!(*buf))
>   			return -ENOMEM;
>   
> -		memset(*buf, 0, len);
>   		return 0;
>   }
>   
> 

Looks Good.

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Martin K. Petersen May 21, 2021, 8:31 p.m. UTC | #2
Yang,

> Use vzalloc() instead of vmalloc() and memset(0) to simpify the code.

Applied to 5.14/scsi-staging, thanks!
Martin K. Petersen May 26, 2021, 4:07 a.m. UTC | #3
On Tue, 18 May 2021 21:20:18 +0800, Yang Yingliang wrote:

> Use vzalloc() instead of vmalloc() and memset(0) to simpify
> the code.

Applied to 5.14/scsi-queue, thanks!

[1/1] scsi: qedf: use vzalloc() instead of vmalloc()/memset(0)
      https://git.kernel.org/mkp/scsi/c/2a38d2a8b4a6
diff mbox series

Patch

diff --git a/drivers/scsi/qedf/qedf_dbg.c b/drivers/scsi/qedf/qedf_dbg.c
index e0387e495261..0d2aed82882a 100644
--- a/drivers/scsi/qedf/qedf_dbg.c
+++ b/drivers/scsi/qedf/qedf_dbg.c
@@ -106,11 +106,10 @@  qedf_dbg_info(struct qedf_dbg_ctx *qedf, const char *func, u32 line,
 int
 qedf_alloc_grc_dump_buf(u8 **buf, uint32_t len)
 {
-		*buf = vmalloc(len);
+		*buf = vzalloc(len);
 		if (!(*buf))
 			return -ENOMEM;
 
-		memset(*buf, 0, len);
 		return 0;
 }