i2c: cht-wc: drop check because i2c_unregister_device() is NULL safe
diff mbox series

Message ID 20190820153441.7693-1-wsa+renesas@sang-engineering.com
State Accepted
Headers show
Series
  • i2c: cht-wc: drop check because i2c_unregister_device() is NULL safe
Related show

Commit Message

Wolfram Sang Aug. 20, 2019, 3:34 p.m. UTC
No need to check the argument of i2c_unregister_device() because the
function itself does it.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Build tested only, buildbot is happy, too.

Please apply to your tree.

 drivers/i2c/busses/i2c-cht-wc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Wolfram Sang Sept. 3, 2019, 5:52 p.m. UTC | #1
On Tue, Aug 20, 2019 at 05:34:40PM +0200, Wolfram Sang wrote:
> No need to check the argument of i2c_unregister_device() because the
> function itself does it.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---

Hans, are you OK with this change?

> Build tested only, buildbot is happy, too.
> 
> Please apply to your tree.
> 
>  drivers/i2c/busses/i2c-cht-wc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
> index 66af44bfa67d..3e2608a65c06 100644
> --- a/drivers/i2c/busses/i2c-cht-wc.c
> +++ b/drivers/i2c/busses/i2c-cht-wc.c
> @@ -363,8 +363,7 @@ static int cht_wc_i2c_adap_i2c_remove(struct platform_device *pdev)
>  {
>  	struct cht_wc_i2c_adap *adap = platform_get_drvdata(pdev);
>  
> -	if (adap->client)
> -		i2c_unregister_device(adap->client);
> +	i2c_unregister_device(adap->client);
>  	i2c_del_adapter(&adap->adapter);
>  	irq_domain_remove(adap->irq_domain);
>  
> -- 
> 2.20.1
>
Hans de Goede Sept. 4, 2019, 8:26 a.m. UTC | #2
Hi,

On 03-09-19 19:52, Wolfram Sang wrote:
> On Tue, Aug 20, 2019 at 05:34:40PM +0200, Wolfram Sang wrote:
>> No need to check the argument of i2c_unregister_device() because the
>> function itself does it.
>>
>> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>> ---
> 
> Hans, are you OK with this change?

Yes this is fine by me:

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> 
>> Build tested only, buildbot is happy, too.
>>
>> Please apply to your tree.
>>
>>   drivers/i2c/busses/i2c-cht-wc.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
>> index 66af44bfa67d..3e2608a65c06 100644
>> --- a/drivers/i2c/busses/i2c-cht-wc.c
>> +++ b/drivers/i2c/busses/i2c-cht-wc.c
>> @@ -363,8 +363,7 @@ static int cht_wc_i2c_adap_i2c_remove(struct platform_device *pdev)
>>   {
>>   	struct cht_wc_i2c_adap *adap = platform_get_drvdata(pdev);
>>   
>> -	if (adap->client)
>> -		i2c_unregister_device(adap->client);
>> +	i2c_unregister_device(adap->client);
>>   	i2c_del_adapter(&adap->adapter);
>>   	irq_domain_remove(adap->irq_domain);
>>   
>> -- 
>> 2.20.1
>>
Wolfram Sang Sept. 4, 2019, 9:12 p.m. UTC | #3
On Tue, Aug 20, 2019 at 05:34:40PM +0200, Wolfram Sang wrote:
> No need to check the argument of i2c_unregister_device() because the
> function itself does it.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!

Patch
diff mbox series

diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
index 66af44bfa67d..3e2608a65c06 100644
--- a/drivers/i2c/busses/i2c-cht-wc.c
+++ b/drivers/i2c/busses/i2c-cht-wc.c
@@ -363,8 +363,7 @@  static int cht_wc_i2c_adap_i2c_remove(struct platform_device *pdev)
 {
 	struct cht_wc_i2c_adap *adap = platform_get_drvdata(pdev);
 
-	if (adap->client)
-		i2c_unregister_device(adap->client);
+	i2c_unregister_device(adap->client);
 	i2c_del_adapter(&adap->adapter);
 	irq_domain_remove(adap->irq_domain);