[PATCH 2/3] hw/display/qxl: Remove unneeded variable assignment

Philippe Mathieu-Daudé posted 3 patches 5 years, 9 months ago
Maintainers: "Philippe Mathieu-Daudé" <philmd@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>, Max Reitz <mreitz@redhat.com>, John Snow <jsnow@redhat.com>
[PATCH 2/3] hw/display/qxl: Remove unneeded variable assignment
Posted by Philippe Mathieu-Daudé 5 years, 9 months ago
Fix warning reported by Clang static code analyzer:

  hw/display/qxl.c:1634:14: warning: Value stored to 'orig_io_port' during its initialization is never read
      uint32_t orig_io_port = io_port;
               ^~~~~~~~~~~~   ~~~~~~~

Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/display/qxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 64884da708..21a43a1d5e 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -1631,7 +1631,7 @@ static void ioport_write(void *opaque, hwaddr addr,
     PCIQXLDevice *d = opaque;
     uint32_t io_port = addr;
     qxl_async_io async = QXL_SYNC;
-    uint32_t orig_io_port = io_port;
+    uint32_t orig_io_port;
 
     if (d->guest_bug && io_port != QXL_IO_RESET) {
         return;
-- 
2.21.1


Re: [PATCH 2/3] hw/display/qxl: Remove unneeded variable assignment
Posted by Richard Henderson 5 years, 9 months ago
On 2/15/20 8:15 AM, Philippe Mathieu-Daudé wrote:
> Fix warning reported by Clang static code analyzer:
> 
>   hw/display/qxl.c:1634:14: warning: Value stored to 'orig_io_port' during its initialization is never read
>       uint32_t orig_io_port = io_port;
>                ^~~~~~~~~~~~   ~~~~~~~
> 
> Reported-by: Clang Static Analyzer
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/display/qxl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

Re: [PATCH 2/3] hw/display/qxl: Remove unneeded variable assignment
Posted by Laurent Vivier 5 years, 8 months ago
Le 15/02/2020 à 17:15, Philippe Mathieu-Daudé a écrit :
> Fix warning reported by Clang static code analyzer:
> 
>   hw/display/qxl.c:1634:14: warning: Value stored to 'orig_io_port' during its initialization is never read
>       uint32_t orig_io_port = io_port;
>                ^~~~~~~~~~~~   ~~~~~~~
> 
> Reported-by: Clang Static Analyzer
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/display/qxl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/display/qxl.c b/hw/display/qxl.c
> index 64884da708..21a43a1d5e 100644
> --- a/hw/display/qxl.c
> +++ b/hw/display/qxl.c
> @@ -1631,7 +1631,7 @@ static void ioport_write(void *opaque, hwaddr addr,
>      PCIQXLDevice *d = opaque;
>      uint32_t io_port = addr;
>      qxl_async_io async = QXL_SYNC;
> -    uint32_t orig_io_port = io_port;
> +    uint32_t orig_io_port;
>  
>      if (d->guest_bug && io_port != QXL_IO_RESET) {
>          return;
> 

Applied to my trivial-patches branch.

Thanks,
Laurent