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

Lyude Paul lyude at redhat.com
Tue Mar 3 18:58:55 UTC 2020


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 at 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 at 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);
> >  }
> >  
-- 
Cheers,
	Lyude Paul (she/her)
	Associate Software Engineer at Red Hat



More information about the dri-devel mailing list