diff mbox series

[6/9] drm/nouveau: Fix unused variable warning

Message ID 20200302125649.61443-7-pankaj.laxminarayan.bharadiya@intel.com (mailing list archive)
State New, archived
Headers show
Series drm: drm_fb_helper cleanup. | expand

Commit Message

Pankaj Bharadiya March 2, 2020, 12:56 p.m. UTC
nouveau_drm pointer is not getting used anymore in
nv50_mstm_{register,destroy}_connector functions, hence remove it.

This fixes below warning.

drivers/gpu/drm/nouveau/dispnv50/disp.c: In function ‘nv50_mstm_destroy_connector’:
drivers/gpu/drm/nouveau/dispnv50/disp.c:1263:22: warning: unused variable ‘drm’ [-Wunused-variable]
  struct nouveau_drm *drm = nouveau_drm(connector->dev);
                      ^~~
drivers/gpu/drm/nouveau/dispnv50/disp.c: In function ‘nv50_mstm_register_connector’:
drivers/gpu/drm/nouveau/dispnv50/disp.c:1274:22: warning: unused variable ‘drm’ [-Wunused-variable]
  struct nouveau_drm *drm = nouveau_drm(connector->dev);
                      ^~~

Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Laurent Pinchart March 2, 2020, 1:30 p.m. UTC | #1
Hi Pankaj,

Thank you for the patch.

On Mon, Mar 02, 2020 at 06:26:46PM +0530, Pankaj Bharadiya wrote:
> nouveau_drm pointer is not getting used anymore in
> nv50_mstm_{register,destroy}_connector functions, hence remove it.
> 
> This fixes below warning.
> 
> drivers/gpu/drm/nouveau/dispnv50/disp.c: In function ‘nv50_mstm_destroy_connector’:
> drivers/gpu/drm/nouveau/dispnv50/disp.c:1263:22: warning: unused variable ‘drm’ [-Wunused-variable]
>   struct nouveau_drm *drm = nouveau_drm(connector->dev);
>                       ^~~
> drivers/gpu/drm/nouveau/dispnv50/disp.c: In function ‘nv50_mstm_register_connector’:
> drivers/gpu/drm/nouveau/dispnv50/disp.c:1274:22: warning: unused variable ‘drm’ [-Wunused-variable]
>   struct nouveau_drm *drm = nouveau_drm(connector->dev);
>                       ^~~

As commented on 7/9, you should squash this with the patch that
introduces the warnings.

> Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
> ---
>  drivers/gpu/drm/nouveau/dispnv50/disp.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> index 97dd50e2917d..4e164ad8003f 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> @@ -1260,7 +1260,6 @@ static void
>  nv50_mstm_destroy_connector(struct drm_dp_mst_topology_mgr *mgr,
>  			    struct drm_connector *connector)
>  {
> -	struct nouveau_drm *drm = nouveau_drm(connector->dev);
>  	struct nv50_mstc *mstc = nv50_mstc(connector);
>  
>  	drm_connector_unregister(&mstc->connector);
> @@ -1271,8 +1270,6 @@ nv50_mstm_destroy_connector(struct drm_dp_mst_topology_mgr *mgr,
>  static void
>  nv50_mstm_register_connector(struct drm_connector *connector)
>  {
> -	struct nouveau_drm *drm = nouveau_drm(connector->dev);
> -
>  	drm_connector_register(connector);
>  }
>
Lyude Paul March 3, 2020, 6:58 p.m. UTC | #2
On Mon, 2020-03-02 at 15:30 +0200, Laurent Pinchart wrote:
> Hi Pankaj,
> 
> Thank you for the patch.
> 
> On Mon, Mar 02, 2020 at 06:26:46PM +0530, Pankaj Bharadiya wrote:
> > nouveau_drm pointer is not getting used anymore in
> > nv50_mstm_{register,destroy}_connector functions, hence remove it.
> > 
> > This fixes below warning.
> > 
> > drivers/gpu/drm/nouveau/dispnv50/disp.c: In function
> > ‘nv50_mstm_destroy_connector’:
> > drivers/gpu/drm/nouveau/dispnv50/disp.c:1263:22: warning: unused variable
> > ‘drm’ [-Wunused-variable]
> >   struct nouveau_drm *drm = nouveau_drm(connector->dev);
> >                       ^~~
> > drivers/gpu/drm/nouveau/dispnv50/disp.c: In function
> > ‘nv50_mstm_register_connector’:
> > drivers/gpu/drm/nouveau/dispnv50/disp.c:1274:22: warning: unused variable
> > ‘drm’ [-Wunused-variable]
> >   struct nouveau_drm *drm = nouveau_drm(connector->dev);
> >                       ^~~
> 
> As commented on 7/9, you should squash this with the patch that
> introduces the warnings.

Agreed, with the patches squashed you can count this as:

Reviewed-by: Lyude Paul <lyude@redhat.com>

fwiw - completely optional but if you'd like, you can probably also go ahead
and remove drm_dp_mst_topology_mgr_cbs.register_connector and
drm_dp_mst_topology_mgr_cbs.destroy_connector and replace them with open-
coding, since those callbacks are literally identical amongst every driver and
don't do anything other then call
drm_connector_register()/drm_connector_unregister()/drm_connector_put().

> > Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
> > ---
> >  drivers/gpu/drm/nouveau/dispnv50/disp.c | 3 ---
> >  1 file changed, 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> > b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> > index 97dd50e2917d..4e164ad8003f 100644
> > --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> > +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> > @@ -1260,7 +1260,6 @@ static void
> >  nv50_mstm_destroy_connector(struct drm_dp_mst_topology_mgr *mgr,
> >  			    struct drm_connector *connector)
> >  {
> > -	struct nouveau_drm *drm = nouveau_drm(connector->dev);
> >  	struct nv50_mstc *mstc = nv50_mstc(connector);
> >  
> >  	drm_connector_unregister(&mstc->connector);
> > @@ -1271,8 +1270,6 @@ nv50_mstm_destroy_connector(struct
> > drm_dp_mst_topology_mgr *mgr,
> >  static void
> >  nv50_mstm_register_connector(struct drm_connector *connector)
> >  {
> > -	struct nouveau_drm *drm = nouveau_drm(connector->dev);
> > -
> >  	drm_connector_register(connector);
> >  }
> >
diff mbox series

Patch

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 97dd50e2917d..4e164ad8003f 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -1260,7 +1260,6 @@  static void
 nv50_mstm_destroy_connector(struct drm_dp_mst_topology_mgr *mgr,
 			    struct drm_connector *connector)
 {
-	struct nouveau_drm *drm = nouveau_drm(connector->dev);
 	struct nv50_mstc *mstc = nv50_mstc(connector);
 
 	drm_connector_unregister(&mstc->connector);
@@ -1271,8 +1270,6 @@  nv50_mstm_destroy_connector(struct drm_dp_mst_topology_mgr *mgr,
 static void
 nv50_mstm_register_connector(struct drm_connector *connector)
 {
-	struct nouveau_drm *drm = nouveau_drm(connector->dev);
-
 	drm_connector_register(connector);
 }