From patchwork Wed Aug 8 22:13:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Khoroshilov X-Patchwork-Id: 955256 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-rtc-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ispras.ru Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41m5Hg3G7Fz9s1c for ; Thu, 9 Aug 2018 08:13:19 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729729AbeHIAe5 (ORCPT ); Wed, 8 Aug 2018 20:34:57 -0400 Received: from mail.ispras.ru ([83.149.199.45]:37182 "EHLO mail.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727337AbeHIAe5 (ORCPT ); Wed, 8 Aug 2018 20:34:57 -0400 Received: from localhost.localdomain (ppp85-140-183-102.pppoe.mtu-net.ru [85.140.183.102]) by mail.ispras.ru (Postfix) with ESMTPSA id C42E7540093; Thu, 9 Aug 2018 01:13:14 +0300 (MSK) From: Alexey Khoroshilov To: Denis Osterland , Michael Grzeschik , Alessandro Zummo , Alexandre Belloni Cc: Alexey Khoroshilov , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: [PATCH] rtc: isl1208: fix error handling in isl1208_probe() Date: Thu, 9 Aug 2018 01:13:07 +0300 Message-Id: <1533766387-30529-1-git-send-email-khoroshilov@ispras.ru> X-Mailer: git-send-email 2.7.4 Sender: linux-rtc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org After moving rtc_register_device() sysfs group is left unremoved on the error path. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Fixes: 236b7187034e ("rtc: isl1208: switch to rtc_register_device") --- drivers/rtc/rtc-isl1208.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index 1a2c38cc0178..4b5df9bfb8d4 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -674,7 +674,12 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) } } - return rtc_register_device(rtc); + rc = rtc_register_device(rtc); + if (rc) { + sysfs_remove_group(&client->dev.kobj, &isl1208_rtc_sysfs_files); + return rc; + } + return 0; } static int