[PATCH] ppc/pnv: Make PnvXScomInterface an incomplete type

Greg Kurz posted 1 patch 4 years, 4 months ago
Test docker-quick@centos7 failed
Test asan failed
Test checkpatch failed
Test FreeBSD failed
Test docker-mingw@fedora failed
Test docker-clang@ubuntu failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/157607473444.179018.14127987124523137347.stgit@bahia.lan
Maintainers: David Gibson <david@gibson.dropbear.id.au>, "Cédric Le Goater" <clg@kaod.org>
There is a newer version of this series
include/hw/ppc/pnv_xscom.h |    4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] ppc/pnv: Make PnvXScomInterface an incomplete type
Posted by Greg Kurz 4 years, 4 months ago
PnvXScomInterface is an interface instance. It should never be
dereferenced. Drop the dummy type definition for extra safety,
which is the common practice with QOM interfaces.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 include/hw/ppc/pnv_xscom.h |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h
index 1c1d76bf9be5..b738011ab205 100644
--- a/include/hw/ppc/pnv_xscom.h
+++ b/include/hw/ppc/pnv_xscom.h
@@ -22,9 +22,7 @@
 
 #include "qom/object.h"
 
-typedef struct PnvXScomInterface {
-    Object parent;
-} PnvXScomInterface;
+typedef struct PnvXScomInterface PnvXScomInterface;
 
 #define TYPE_PNV_XSCOM_INTERFACE "pnv-xscom-interface"
 #define PNV_XSCOM_INTERFACE(obj) \


Re: [PATCH] ppc/pnv: Make PnvXScomInterface an incomplete type
Posted by Cédric Le Goater 4 years, 4 months ago
On 11/12/2019 15:32, Greg Kurz wrote:
> PnvXScomInterface is an interface instance. It should never be
> dereferenced. Drop the dummy type definition for extra safety,
> which is the common practice with QOM interfaces.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
>  include/hw/ppc/pnv_xscom.h |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h
> index 1c1d76bf9be5..b738011ab205 100644
> --- a/include/hw/ppc/pnv_xscom.h
> +++ b/include/hw/ppc/pnv_xscom.h
> @@ -22,9 +22,7 @@
>  
>  #include "qom/object.h"
>  
> -typedef struct PnvXScomInterface {
> -    Object parent;
> -} PnvXScomInterface;
> +typedef struct PnvXScomInterface PnvXScomInterface;
>  
>  #define TYPE_PNV_XSCOM_INTERFACE "pnv-xscom-interface"
>  #define PNV_XSCOM_INTERFACE(obj) \

We should use INTERFACE_CHECK() here.

C.

 


Re: [PATCH] ppc/pnv: Make PnvXScomInterface an incomplete type
Posted by Greg Kurz 4 years, 4 months ago
On Wed, 11 Dec 2019 16:35:41 +0100
Cédric Le Goater <clg@kaod.org> wrote:

> On 11/12/2019 15:32, Greg Kurz wrote:
> > PnvXScomInterface is an interface instance. It should never be
> > dereferenced. Drop the dummy type definition for extra safety,
> > which is the common practice with QOM interfaces.
> > 
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> > ---
> >  include/hw/ppc/pnv_xscom.h |    4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h
> > index 1c1d76bf9be5..b738011ab205 100644
> > --- a/include/hw/ppc/pnv_xscom.h
> > +++ b/include/hw/ppc/pnv_xscom.h
> > @@ -22,9 +22,7 @@
> >  
> >  #include "qom/object.h"
> >  
> > -typedef struct PnvXScomInterface {
> > -    Object parent;
> > -} PnvXScomInterface;
> > +typedef struct PnvXScomInterface PnvXScomInterface;
> >  
> >  #define TYPE_PNV_XSCOM_INTERFACE "pnv-xscom-interface"
> >  #define PNV_XSCOM_INTERFACE(obj) \
> 
> We should use INTERFACE_CHECK() here.
> 

Heh you're right, I missed that :) I'll send a v2 right away.

> C.
> 
>  
>