From patchwork Tue Oct 31 14:21:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 10034679 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EAA8D60291 for ; Tue, 31 Oct 2017 14:23:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCC7E28B24 for ; Tue, 31 Oct 2017 14:23:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1A5E28B77; Tue, 31 Oct 2017 14:23:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26E0A28B3C for ; Tue, 31 Oct 2017 14:23:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753539AbdJaOXd (ORCPT ); Tue, 31 Oct 2017 10:23:33 -0400 Received: from mga04.intel.com ([192.55.52.120]:36400 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753518AbdJaOXb (ORCPT ); Tue, 31 Oct 2017 10:23:31 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Oct 2017 07:23:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,324,1505804400"; d="scan'208";a="1237732471" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 31 Oct 2017 07:23:25 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1BE41772; Tue, 31 Oct 2017 16:21:51 +0200 (EET) From: Andy Shevchenko To: linux-i2c@vger.kernel.org, Wolfram Sang Cc: Andy Shevchenko , Rudolf Marek , Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org Subject: [PATCH v1 12/15] hwmon: (w83793) Remove duplicate NULL check Date: Tue, 31 Oct 2017 16:21:46 +0200 Message-Id: <20171031142149.32512-12-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171031142149.32512-1-andriy.shevchenko@linux.intel.com> References: <20171031142149.32512-1-andriy.shevchenko@linux.intel.com> Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since i2c_unregister_device() became NULL-aware we may remove duplicate NULL check. Cc: Rudolf Marek Cc: Jean Delvare Cc: Guenter Roeck Cc: linux-hwmon@vger.kernel.org Signed-off-by: Andy Shevchenko Reviewed-by: Jean Delvare --- drivers/hwmon/w83793.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c index 5ba9d9f1daa1..0af0f6283b35 100644 --- a/drivers/hwmon/w83793.c +++ b/drivers/hwmon/w83793.c @@ -1564,10 +1564,8 @@ static int w83793_remove(struct i2c_client *client) for (i = 0; i < ARRAY_SIZE(w83793_temp); i++) device_remove_file(dev, &w83793_temp[i].dev_attr); - if (data->lm75[0] != NULL) - i2c_unregister_device(data->lm75[0]); - if (data->lm75[1] != NULL) - i2c_unregister_device(data->lm75[1]); + i2c_unregister_device(data->lm75[0]); + i2c_unregister_device(data->lm75[1]); /* Decrease data reference counter */ mutex_lock(&watchdog_data_mutex); @@ -1625,8 +1623,7 @@ w83793_detect_subclients(struct i2c_client *client) /* Undo inits in case of errors */ ERROR_SC_1: - if (data->lm75[0] != NULL) - i2c_unregister_device(data->lm75[0]); + i2c_unregister_device(data->lm75[0]); ERROR_SC_0: return err; } @@ -1962,10 +1959,8 @@ static int w83793_probe(struct i2c_client *client, for (i = 0; i < ARRAY_SIZE(w83793_temp); i++) device_remove_file(dev, &w83793_temp[i].dev_attr); - if (data->lm75[0] != NULL) - i2c_unregister_device(data->lm75[0]); - if (data->lm75[1] != NULL) - i2c_unregister_device(data->lm75[1]); + i2c_unregister_device(data->lm75[0]); + i2c_unregister_device(data->lm75[1]); free_mem: kfree(data); exit: