* [patch] drm/i915/gvt/kvmgt: remove some dead code
@ 2017-02-07 13:16 ` Dan Carpenter
0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2017-02-07 13:16 UTC (permalink / raw)
To: Zhenyu Wang, Jike Song
Cc: intel-gfx, kernel-janitors, dri-devel, Daniel Vetter,
intel-gvt-dev, Zhi Wang
If "caps.buf" is already NULL then it doesn't need to be freed or set to
NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index 3f656e3a6e5a..de2a55178a37 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -965,11 +965,8 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
sparse->areas[0].offset PAGE_ALIGN(vgpu_aperture_offset(vgpu));
sparse->areas[0].size = vgpu_aperture_sz(vgpu);
- if (!caps.buf) {
- kfree(caps.buf);
- caps.buf = NULL;
+ if (!caps.buf)
caps.size = 0;
- }
break;
case VFIO_PCI_BAR3_REGION_INDEX ... VFIO_PCI_BAR5_REGION_INDEX:
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [patch] drm/i915/gvt/kvmgt: remove some dead code
@ 2017-02-07 13:16 ` Dan Carpenter
0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2017-02-07 13:16 UTC (permalink / raw)
To: Zhenyu Wang, Jike Song
Cc: intel-gfx, kernel-janitors, dri-devel, Daniel Vetter,
intel-gvt-dev, Zhi Wang
If "caps.buf" is already NULL then it doesn't need to be freed or set to
NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index 3f656e3a6e5a..de2a55178a37 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -965,11 +965,8 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
sparse->areas[0].offset =
PAGE_ALIGN(vgpu_aperture_offset(vgpu));
sparse->areas[0].size = vgpu_aperture_sz(vgpu);
- if (!caps.buf) {
- kfree(caps.buf);
- caps.buf = NULL;
+ if (!caps.buf)
caps.size = 0;
- }
break;
case VFIO_PCI_BAR3_REGION_INDEX ... VFIO_PCI_BAR5_REGION_INDEX:
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Intel-gfx] [patch] drm/i915/gvt/kvmgt: remove some dead code
2017-02-07 13:16 ` Dan Carpenter
@ 2017-02-07 14:34 ` Joonas Lahtinen
-1 siblings, 0 replies; 12+ messages in thread
From: Joonas Lahtinen @ 2017-02-07 14:34 UTC (permalink / raw)
To: Dan Carpenter, Zhenyu Wang, Jike Song
Cc: David Airlie, intel-gfx, kernel-janitors, dri-devel,
Daniel Vetter, intel-gvt-dev
On ti, 2017-02-07 at 16:16 +0300, Dan Carpenter wrote:
> If "caps.buf" is already NULL then it doesn't need to be freed or set to
> NULL.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
<SNIP>
> @@ -965,11 +965,8 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
> sparse->areas[0].offset > PAGE_ALIGN(vgpu_aperture_offset(vgpu));
> sparse->areas[0].size = vgpu_aperture_sz(vgpu);
> - if (!caps.buf) {
Looking at the code around, the right thing would be to just remove the
negation? This currently seems like a memory leak.
> - kfree(caps.buf);
> - caps.buf = NULL;
> + if (!caps.buf)
> caps.size = 0;
> - }
And quickly looking, the caps is pre-initialized but unused at this
point, so the whole if could just be removed, right?
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] drm/i915/gvt/kvmgt: remove some dead code
@ 2017-02-07 14:34 ` Joonas Lahtinen
0 siblings, 0 replies; 12+ messages in thread
From: Joonas Lahtinen @ 2017-02-07 14:34 UTC (permalink / raw)
To: Dan Carpenter, Zhenyu Wang, Jike Song
Cc: David Airlie, intel-gfx, kernel-janitors, dri-devel,
Daniel Vetter, intel-gvt-dev
On ti, 2017-02-07 at 16:16 +0300, Dan Carpenter wrote:
> If "caps.buf" is already NULL then it doesn't need to be freed or set to
> NULL.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
<SNIP>
> @@ -965,11 +965,8 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
> sparse->areas[0].offset =
> PAGE_ALIGN(vgpu_aperture_offset(vgpu));
> sparse->areas[0].size = vgpu_aperture_sz(vgpu);
> - if (!caps.buf) {
Looking at the code around, the right thing would be to just remove the
negation? This currently seems like a memory leak.
> - kfree(caps.buf);
> - caps.buf = NULL;
> + if (!caps.buf)
> caps.size = 0;
> - }
And quickly looking, the caps is pre-initialized but unused at this
point, so the whole if could just be removed, right?
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Intel-gfx] [patch] drm/i915/gvt/kvmgt: remove some dead code
2017-02-07 14:34 ` Joonas Lahtinen
@ 2017-02-07 14:44 ` Dan Carpenter
-1 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2017-02-07 14:44 UTC (permalink / raw)
To: Joonas Lahtinen
Cc: Zhenyu Wang, Jike Song, David Airlie, intel-gfx, kernel-janitors,
dri-devel, Daniel Vetter, intel-gvt-dev
On Tue, Feb 07, 2017 at 04:34:57PM +0200, Joonas Lahtinen wrote:
> On ti, 2017-02-07 at 16:16 +0300, Dan Carpenter wrote:
> > If "caps.buf" is already NULL then it doesn't need to be freed or set to
> > NULL.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> <SNIP>
>
> > @@ -965,11 +965,8 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
> > sparse->areas[0].offset > > PAGE_ALIGN(vgpu_aperture_offset(vgpu));
> > sparse->areas[0].size = vgpu_aperture_sz(vgpu);
> > - if (!caps.buf) {
>
> Looking at the code around, the right thing would be to just remove the
> negation? This currently seems like a memory leak.
>
> > - kfree(caps.buf);
> > - caps.buf = NULL;
> > + if (!caps.buf)
> > caps.size = 0;
> > - }
>
> And quickly looking, the caps is pre-initialized but unused at this
> point, so the whole if could just be removed, right?
Hm... Duh. You're right. Let me resend.
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Intel-gfx] [patch] drm/i915/gvt/kvmgt: remove some dead code
@ 2017-02-07 14:44 ` Dan Carpenter
0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2017-02-07 14:44 UTC (permalink / raw)
To: Joonas Lahtinen
Cc: Zhenyu Wang, Jike Song, David Airlie, intel-gfx, kernel-janitors,
dri-devel, Daniel Vetter, intel-gvt-dev
On Tue, Feb 07, 2017 at 04:34:57PM +0200, Joonas Lahtinen wrote:
> On ti, 2017-02-07 at 16:16 +0300, Dan Carpenter wrote:
> > If "caps.buf" is already NULL then it doesn't need to be freed or set to
> > NULL.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> <SNIP>
>
> > @@ -965,11 +965,8 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
> > sparse->areas[0].offset =
> > PAGE_ALIGN(vgpu_aperture_offset(vgpu));
> > sparse->areas[0].size = vgpu_aperture_sz(vgpu);
> > - if (!caps.buf) {
>
> Looking at the code around, the right thing would be to just remove the
> negation? This currently seems like a memory leak.
>
> > - kfree(caps.buf);
> > - caps.buf = NULL;
> > + if (!caps.buf)
> > caps.size = 0;
> > - }
>
> And quickly looking, the caps is pre-initialized but unused at this
> point, so the whole if could just be removed, right?
Hm... Duh. You're right. Let me resend.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 12+ messages in thread
* [patch v2] drm/i915/gvt/kvmgt: remove some dead code
2017-02-07 14:34 ` Joonas Lahtinen
@ 2017-02-07 14:53 ` Dan Carpenter
-1 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2017-02-07 14:53 UTC (permalink / raw)
To: Zhenyu Wang, Jike Song
Cc: David Airlie, intel-gfx, kernel-janitors, dri-devel,
Daniel Vetter, intel-gvt-dev
"caps.buf" is always NULL here and "caps.size" is always zero. The code
is a no-op and can be removed.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index 3f656e3a6e5a..773a45aa18f8 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -965,11 +965,6 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
sparse->areas[0].offset PAGE_ALIGN(vgpu_aperture_offset(vgpu));
sparse->areas[0].size = vgpu_aperture_sz(vgpu);
- if (!caps.buf) {
- kfree(caps.buf);
- caps.buf = NULL;
- caps.size = 0;
- }
break;
case VFIO_PCI_BAR3_REGION_INDEX ... VFIO_PCI_BAR5_REGION_INDEX:
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [patch v2] drm/i915/gvt/kvmgt: remove some dead code
@ 2017-02-07 14:53 ` Dan Carpenter
0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2017-02-07 14:53 UTC (permalink / raw)
To: Zhenyu Wang, Jike Song
Cc: David Airlie, intel-gfx, kernel-janitors, dri-devel,
Daniel Vetter, intel-gvt-dev
"caps.buf" is always NULL here and "caps.size" is always zero. The code
is a no-op and can be removed.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index 3f656e3a6e5a..773a45aa18f8 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -965,11 +965,6 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
sparse->areas[0].offset =
PAGE_ALIGN(vgpu_aperture_offset(vgpu));
sparse->areas[0].size = vgpu_aperture_sz(vgpu);
- if (!caps.buf) {
- kfree(caps.buf);
- caps.buf = NULL;
- caps.size = 0;
- }
break;
case VFIO_PCI_BAR3_REGION_INDEX ... VFIO_PCI_BAR5_REGION_INDEX:
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Intel-gfx] [patch v2] drm/i915/gvt/kvmgt: remove some dead code
2017-02-07 14:53 ` Dan Carpenter
@ 2017-02-08 12:49 ` Joonas Lahtinen
-1 siblings, 0 replies; 12+ messages in thread
From: Joonas Lahtinen @ 2017-02-08 12:49 UTC (permalink / raw)
To: Dan Carpenter, Zhenyu Wang, Jike Song
Cc: David Airlie, intel-gfx, kernel-janitors, dri-devel,
Daniel Vetter, intel-gvt-dev
On ti, 2017-02-07 at 17:53 +0300, Dan Carpenter wrote:
> "caps.buf" is always NULL here and "caps.size" is always zero. The code
> is a no-op and can be removed.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
I assume Zhenyu will merge this through their tree.
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch v2] drm/i915/gvt/kvmgt: remove some dead code
@ 2017-02-08 12:49 ` Joonas Lahtinen
0 siblings, 0 replies; 12+ messages in thread
From: Joonas Lahtinen @ 2017-02-08 12:49 UTC (permalink / raw)
To: Dan Carpenter, Zhenyu Wang, Jike Song
Cc: David Airlie, intel-gfx, kernel-janitors, dri-devel,
Daniel Vetter, intel-gvt-dev
On ti, 2017-02-07 at 17:53 +0300, Dan Carpenter wrote:
> "caps.buf" is always NULL here and "caps.size" is always zero. The code
> is a no-op and can be removed.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
I assume Zhenyu will merge this through their tree.
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Intel-gfx] [patch v2] drm/i915/gvt/kvmgt: remove some dead code
2017-02-08 12:49 ` Joonas Lahtinen
@ 2017-02-09 1:40 ` Zhenyu Wang
-1 siblings, 0 replies; 12+ messages in thread
From: Zhenyu Wang @ 2017-02-09 1:40 UTC (permalink / raw)
To: Joonas Lahtinen
Cc: Jike Song, intel-gfx, kernel-janitors, dri-devel, Daniel Vetter,
intel-gvt-dev, Dan Carpenter
[-- Attachment #1: Type: text/plain, Size: 572 bytes --]
On 2017.02.08 14:49:22 +0200, Joonas Lahtinen wrote:
> On ti, 2017-02-07 at 17:53 +0300, Dan Carpenter wrote:
> > "caps.buf" is always NULL here and "caps.size" is always zero. The code
> > is a no-op and can be removed.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>
> I assume Zhenyu will merge this through their tree.
>
yeah, already put in queue. Thanks!
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Intel-gfx] [patch v2] drm/i915/gvt/kvmgt: remove some dead code
@ 2017-02-09 1:40 ` Zhenyu Wang
0 siblings, 0 replies; 12+ messages in thread
From: Zhenyu Wang @ 2017-02-09 1:40 UTC (permalink / raw)
To: Joonas Lahtinen
Cc: Jike Song, intel-gfx, kernel-janitors, dri-devel, Daniel Vetter,
intel-gvt-dev, Dan Carpenter
[-- Attachment #1.1: Type: text/plain, Size: 572 bytes --]
On 2017.02.08 14:49:22 +0200, Joonas Lahtinen wrote:
> On ti, 2017-02-07 at 17:53 +0300, Dan Carpenter wrote:
> > "caps.buf" is always NULL here and "caps.size" is always zero. The code
> > is a no-op and can be removed.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>
> I assume Zhenyu will merge this through their tree.
>
yeah, already put in queue. Thanks!
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-02-09 1:40 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 13:16 [patch] drm/i915/gvt/kvmgt: remove some dead code Dan Carpenter
2017-02-07 13:16 ` Dan Carpenter
2017-02-07 14:34 ` [Intel-gfx] " Joonas Lahtinen
2017-02-07 14:34 ` Joonas Lahtinen
2017-02-07 14:44 ` [Intel-gfx] " Dan Carpenter
2017-02-07 14:44 ` Dan Carpenter
2017-02-07 14:53 ` [patch v2] " Dan Carpenter
2017-02-07 14:53 ` Dan Carpenter
2017-02-08 12:49 ` [Intel-gfx] " Joonas Lahtinen
2017-02-08 12:49 ` Joonas Lahtinen
2017-02-09 1:40 ` [Intel-gfx] " Zhenyu Wang
2017-02-09 1:40 ` Zhenyu Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.