From patchwork Tue Oct 31 14:21:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 10034633 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 B0B0E60291 for ; Tue, 31 Oct 2017 14:22:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A301828AE7 for ; Tue, 31 Oct 2017 14:22:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97D2528B63; Tue, 31 Oct 2017 14:22:28 +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 7556B28B6A for ; Tue, 31 Oct 2017 14:22:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753220AbdJaOW0 (ORCPT ); Tue, 31 Oct 2017 10:22:26 -0400 Received: from mga11.intel.com ([192.55.52.93]:28036 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752209AbdJaOW0 (ORCPT ); Tue, 31 Oct 2017 10:22:26 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Oct 2017 07:22:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,324,1505804400"; d="scan'208";a="1031652367" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 31 Oct 2017 07:22:24 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 11FE974D; Tue, 31 Oct 2017 16:21:51 +0200 (EET) From: Andy Shevchenko To: linux-i2c@vger.kernel.org, Wolfram Sang Cc: Andy Shevchenko , Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org Subject: [PATCH v1 11/15] hwmon: (w83792d) Remove duplicate NULL check Date: Tue, 31 Oct 2017 16:21:45 +0200 Message-Id: <20171031142149.32512-11-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: Jean Delvare Cc: Guenter Roeck Cc: linux-hwmon@vger.kernel.org Signed-off-by: Andy Shevchenko Reviewed-by: Jean Delvare --- drivers/hwmon/w83792d.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index d764602d70db..76aa39e537e0 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c @@ -981,8 +981,7 @@ w83792d_detect_subclients(struct i2c_client *new_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; } @@ -1456,10 +1455,8 @@ w83792d_probe(struct i2c_client *client, const struct i2c_device_id *id) for (i = 0; i < ARRAY_SIZE(w83792d_group_fan); i++) sysfs_remove_group(&dev->kobj, &w83792d_group_fan[i]); exit_i2c_unregister: - 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]); return err; } @@ -1475,10 +1472,8 @@ w83792d_remove(struct i2c_client *client) sysfs_remove_group(&client->dev.kobj, &w83792d_group_fan[i]); - 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]); return 0; }