diff mbox series

[2/2] nvme/ctrl: remove useless type cast

Message ID 20240722091728.4334-3-yaoxt.fnst@fujitsu.com (mailing list archive)
State New, archived
Headers show
Series remove useless type cast | expand

Commit Message

Xingtao Yao (Fujitsu) July 22, 2024, 9:17 a.m. UTC
The type of req->cmd is NvmeCmd, cast the pointer of this type to
NvmeCmd* is useless.

Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com>
---
 hw/nvme/ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Maydell July 22, 2024, 11:48 a.m. UTC | #1
On Mon, 22 Jul 2024 at 10:19, Yao Xingtao via <qemu-devel@nongnu.org> wrote:
>
> The type of req->cmd is NvmeCmd, cast the pointer of this type to
> NvmeCmd* is useless.
>
> Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com>
> ---
>  hw/nvme/ctrl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index 5b1b0cabcfc3..221818f551cd 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -4167,7 +4167,7 @@ static bool nvme_zone_matches_filter(uint32_t zafs, NvmeZone *zl)
>
>  static uint16_t nvme_zone_mgmt_recv(NvmeCtrl *n, NvmeRequest *req)
>  {
> -    NvmeCmd *cmd = (NvmeCmd *)&req->cmd;
> +    NvmeCmd *cmd = &req->cmd;
>      NvmeNamespace *ns = req->ns;
>      /* cdw12 is zero-based number of dwords to return. Convert to bytes */
>      uint32_t data_size = (le32_to_cpu(cmd->cdw12) + 1) << 2;
> --
> 2.41.0

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Klaus Jensen July 22, 2024, 11:52 a.m. UTC | #2
On Jul 22 05:17, Yao Xingtao wrote:
> The type of req->cmd is NvmeCmd, cast the pointer of this type to
> NvmeCmd* is useless.
> 
> Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com>
> ---
>  hw/nvme/ctrl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index 5b1b0cabcfc3..221818f551cd 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -4167,7 +4167,7 @@ static bool nvme_zone_matches_filter(uint32_t zafs, NvmeZone *zl)
>  
>  static uint16_t nvme_zone_mgmt_recv(NvmeCtrl *n, NvmeRequest *req)
>  {
> -    NvmeCmd *cmd = (NvmeCmd *)&req->cmd;
> +    NvmeCmd *cmd = &req->cmd;
>      NvmeNamespace *ns = req->ns;
>      /* cdw12 is zero-based number of dwords to return. Convert to bytes */
>      uint32_t data_size = (le32_to_cpu(cmd->cdw12) + 1) << 2;
> -- 
> 2.41.0
> 

Thanks! Queued on nvme-next!

Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
diff mbox series

Patch

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 5b1b0cabcfc3..221818f551cd 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4167,7 +4167,7 @@  static bool nvme_zone_matches_filter(uint32_t zafs, NvmeZone *zl)
 
 static uint16_t nvme_zone_mgmt_recv(NvmeCtrl *n, NvmeRequest *req)
 {
-    NvmeCmd *cmd = (NvmeCmd *)&req->cmd;
+    NvmeCmd *cmd = &req->cmd;
     NvmeNamespace *ns = req->ns;
     /* cdw12 is zero-based number of dwords to return. Convert to bytes */
     uint32_t data_size = (le32_to_cpu(cmd->cdw12) + 1) << 2;