diff mbox

[v1,08/15] drm/i2c: tda998x: Remove duplicate NULL check

Message ID 20171031142149.32512-8-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andy Shevchenko Oct. 31, 2017, 2:21 p.m. UTC
Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: Russell King <linux@armlinux.org.uk>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Russell King (Oracle) Oct. 31, 2017, 5:03 p.m. UTC | #1
On Tue, Oct 31, 2017 at 04:21:42PM +0200, Andy Shevchenko wrote:
> Since i2c_unregister_device() became NULL-aware we may remove duplicate
> NULL check.
> 
> Cc: Russell King <linux@armlinux.org.uk>

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

Thanks.

> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpu/drm/i2c/tda998x_drv.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
> index 4d1f45acf2cd..7a349e85f964 100644
> --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> @@ -1602,8 +1602,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
>  	/* if encoder_init fails, the encoder slave is never registered,
>  	 * so cleanup here:
>  	 */
> -	if (priv->cec)
> -		i2c_unregister_device(priv->cec);
> +	i2c_unregister_device(priv->cec);
>  	return -ENXIO;
>  }
>  
> -- 
> 2.14.2
>
Ville Syrjälä Jan. 18, 2018, 3:21 p.m. UTC | #2
On Tue, Oct 31, 2017 at 05:03:43PM +0000, Russell King - ARM Linux wrote:
> On Tue, Oct 31, 2017 at 04:21:42PM +0200, Andy Shevchenko wrote:
> > Since i2c_unregister_device() became NULL-aware we may remove duplicate
> > NULL check.
> > 
> > Cc: Russell King <linux@armlinux.org.uk>
> 
> Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

commit 7b43dd19c9b1 ("i2c: Make i2c_unregister_device() NULL-aware")
seems to be the thing that makes this possible. So these three
patches lgtm -> pushed to drm-misc-next.

> 
> Thanks.
> 
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i2c/tda998x_drv.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
> > index 4d1f45acf2cd..7a349e85f964 100644
> > --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> > +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> > @@ -1602,8 +1602,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
> >  	/* if encoder_init fails, the encoder slave is never registered,
> >  	 * so cleanup here:
> >  	 */
> > -	if (priv->cec)
> > -		i2c_unregister_device(priv->cec);
> > +	i2c_unregister_device(priv->cec);
> >  	return -ENXIO;
> >  }
> >  
> > -- 
> > 2.14.2
> > 
> 
> -- 
> RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
> FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
> According to speedtest.net: 8.21Mbps down 510kbps up
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Andy Shevchenko Jan. 18, 2018, 3:27 p.m. UTC | #3
On Thu, 2018-01-18 at 17:21 +0200, Ville Syrjälä wrote:
> On Tue, Oct 31, 2017 at 05:03:43PM +0000, Russell King - ARM Linux
> wrote:
> > On Tue, Oct 31, 2017 at 04:21:42PM +0200, Andy Shevchenko wrote:
> > > Since i2c_unregister_device() became NULL-aware we may remove
> > > duplicate
> > > NULL check.
> > > 
> > > Cc: Russell King <linux@armlinux.org.uk>
> > 
> > Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
> 
> commit 7b43dd19c9b1 ("i2c: Make i2c_unregister_device() NULL-aware")
> seems to be the thing that makes this possible. So these three
> patches lgtm -> pushed to drm-misc-next.
> 

Thanks, Ville!

> > 
> > Thanks.
> > 
> > > Cc: David Airlie <airlied@linux.ie>
> > > Cc: dri-devel@lists.freedesktop.org
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > ---
> > >  drivers/gpu/drm/i2c/tda998x_drv.c | 3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c
> > > b/drivers/gpu/drm/i2c/tda998x_drv.c
> > > index 4d1f45acf2cd..7a349e85f964 100644
> > > --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> > > +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> > > @@ -1602,8 +1602,7 @@ static int tda998x_create(struct i2c_client
> > > *client, struct tda998x_priv *priv)
> > >  	/* if encoder_init fails, the encoder slave is never
> > > registered,
> > >  	 * so cleanup here:
> > >  	 */
> > > -	if (priv->cec)
> > > -		i2c_unregister_device(priv->cec);
> > > +	i2c_unregister_device(priv->cec);
> > >  	return -ENXIO;
> > >  }
> > >  
> > > -- 
> > > 2.14.2
> > > 
> > 
> > -- 
> > RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
> > FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down
> > 630kbps up
> > According to speedtest.net: 8.21Mbps down 510kbps up
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 4d1f45acf2cd..7a349e85f964 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1602,8 +1602,7 @@  static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
 	/* if encoder_init fails, the encoder slave is never registered,
 	 * so cleanup here:
 	 */
-	if (priv->cec)
-		i2c_unregister_device(priv->cec);
+	i2c_unregister_device(priv->cec);
 	return -ENXIO;
 }