Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp81798pxu; Tue, 5 Jan 2021 05:50:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPzF0D/GVdP8DW7FCndX3+ruHeX3C2dSaHrqiyF1obpeiYRZhCewK9LCOu+X7PACMNzSxC X-Received: by 2002:a17:907:c10:: with SMTP id ga16mr70317625ejc.43.1609854608502; Tue, 05 Jan 2021 05:50:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609854608; cv=none; d=google.com; s=arc-20160816; b=udFSHteEubUzdEH6N0R5iPQacXk5jiJZspdbNSJ0nXcni6OxoJzJZ5uQvvRYj3fIas /Yxaup3m8U/lGWYcCfptcOwW4OE4LuaRFFy1eR49aV5NJE9uMq+I7JMAxTHPA9WFD+E8 CBCtE9ZRD8CblJIE7lTsjAkN1aw+1XkI6MxyG2DO/zTcj6F1uDcKbBZy1iC2FHDLGQe1 d328OJTVgsrSfJnrZGfghHNA7o890b4VK+MPpo401ZzlFmljWxofJzsANDi+e7zEWJiE jXAAye2XZvZ5b7f9iiMNQD80X7RfWnKhqmeCcp8XOzYV5EzAhOYqLRuEME25+Pte2hvO u86w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=MXWwO3xQMpsZXQIjSZeQSg/sLrhlY0LSBGkxq2KXeMs=; b=GHMh/ZaXy0LKJTXVX0N5E44DzApvTs0KEUyasfMyUQNvVDxMDHJtQs0eV+Nja5Tz9a U5SViNMZR+Q5X7UjFwc0Mxj3K8cjOtG/ru8EEyyRrkd0gbbt6RgTS4FEwqh3rkSLbk+Q eZfDvsNchq/uKcTjBoCb3BaYUUSR7oUgyy31sFPaObwXhc+ecwoscUt+wgkAX9kIaYlW 73EQkckYdC+yXOLNpj3tCZMpSYYhu5KDB2OBy+/zlryt3EsaQasgvaYl5XgbfuGQ0UjQ 3opzNxTi/Z7CAWfEmHTn4dgnxqFK9XyAWm/cNitWg2x6gAnK56oxouQUaRmYvByf3Ydh +1SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=qghb7Qeg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si30427970eja.441.2021.01.05.05.49.45; Tue, 05 Jan 2021 05:50:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=qghb7Qeg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730474AbhAENpc (ORCPT + 99 others); Tue, 5 Jan 2021 08:45:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730222AbhAENpa (ORCPT ); Tue, 5 Jan 2021 08:45:30 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 177A6C06179E for ; Tue, 5 Jan 2021 05:44:30 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id t16so36240039wra.3 for ; Tue, 05 Jan 2021 05:44:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MXWwO3xQMpsZXQIjSZeQSg/sLrhlY0LSBGkxq2KXeMs=; b=qghb7Qegw2BRCYZjH32sXzyp9c3+eJc0vVu8Js8hrvKyMj2PjLP+g10K9+8yx8nP1J y/JWW/8u4HaIo5N6CpWEUBYHRfCX9jEL2Se+HKIdl5XV+iwRXcgkcaJ/KBXWud3iA10q mcRVC8dw03LVbdO1DM2L7nmIe301zmu8AEhE7s+brBqFS/2YfT4XI5j9/YAOz2H5JTwJ sM+E9rmONSyRN7rjXRAh9JP2ImmMQjE2rxm0g3fpLCnhZSsMi5LwPtuCExZmp/0Yg5VQ FN0V0OZiJciQTxKBZrQCufNgIBqHWwL4wE1f+kh9ETvn5qjoBI5pyV09kSA754eN9h+6 P+KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MXWwO3xQMpsZXQIjSZeQSg/sLrhlY0LSBGkxq2KXeMs=; b=suEOsTwP8zZKUN2wMOuHgpKhjgzcKk/8OdCp5omiZN5oiGXNh3I4XmHYeNH6EGtHIM WFQszmKc8yFR+6+wArIl4MulWwKt2fX+Gz40nUsI2rY9ls0prJ17o0WduJftQWZHikUW G1UAnJc/oDXYnH2bWUIunX9QMcx/vQbWoKh/vZQqg4I5gsuecH+1/tkWaxBYmFII5h+4 nZLRMJ78+Bkg/BeU6rIXgugk6CW/mID95kVwQrw7a6XerhAZeAp0do1I8VnJsdvLIqci nrqFl/+yyxOuin2IGQIIMqekATHpVyLuuEo2eHdr4PJPzuP1GPhmgooJLXeXxHdDjkJN VRsg== X-Gm-Message-State: AOAM530FqaZgeKkwUBra/VxzFMULG54JflnD7KhVJ8JWoMrpnPFoodDi Az+nQPgYhpvL5n22VP8FQwlwvQ== X-Received: by 2002:a5d:4307:: with SMTP id h7mr85638796wrq.353.1609854268850; Tue, 05 Jan 2021 05:44:28 -0800 (PST) Received: from localhost.localdomain (pop.92-184-112-247.mobile.abo.orange.fr. [92.184.112.247]) by smtp.gmail.com with ESMTPSA id h9sm93873772wre.24.2021.01.05.05.44.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jan 2021 05:44:28 -0800 (PST) From: Bartosz Golaszewski To: Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Alessandro Zummo , Alexandre Belloni Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-rtc@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH] rtc: s5m: use devm_i2c_new_dummy_device() Date: Tue, 5 Jan 2021 14:44:24 +0100 Message-Id: <20210105134424.30632-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.29.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski Use the managed variant of i2c_new_dummy_device() to shrink code and remove the goto label. Signed-off-by: Bartosz Golaszewski --- drivers/rtc/rtc-s5m.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index eb9dde4095a9..3432c6213b4c 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c @@ -760,7 +760,8 @@ static int s5m_rtc_probe(struct platform_device *pdev) return -ENODEV; } - info->i2c = i2c_new_dummy_device(s5m87xx->i2c->adapter, RTC_I2C_ADDR); + info->i2c = devm_i2c_new_dummy_device(&pdev->dev, s5m87xx->i2c->adapter, + RTC_I2C_ADDR); if (IS_ERR(info->i2c)) { dev_err(&pdev->dev, "Failed to allocate I2C for RTC\n"); return PTR_ERR(info->i2c); @@ -768,10 +769,9 @@ static int s5m_rtc_probe(struct platform_device *pdev) info->regmap = devm_regmap_init_i2c(info->i2c, regmap_cfg); if (IS_ERR(info->regmap)) { - ret = PTR_ERR(info->regmap); dev_err(&pdev->dev, "Failed to allocate RTC register map: %d\n", - ret); - goto err; + ret); + return PTR_ERR(info->regmap); } info->dev = &pdev->dev; @@ -781,10 +781,9 @@ static int s5m_rtc_probe(struct platform_device *pdev) if (s5m87xx->irq_data) { info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq); if (info->irq <= 0) { - ret = -EINVAL; dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n", alarm_irq); - goto err; + return -EINVAL; } } @@ -797,10 +796,8 @@ static int s5m_rtc_probe(struct platform_device *pdev) info->rtc_dev = devm_rtc_device_register(&pdev->dev, "s5m-rtc", &s5m_rtc_ops, THIS_MODULE); - if (IS_ERR(info->rtc_dev)) { - ret = PTR_ERR(info->rtc_dev); - goto err; - } + if (IS_ERR(info->rtc_dev)) + return PTR_ERR(info->rtc_dev); if (!info->irq) { dev_info(&pdev->dev, "Alarm IRQ not available\n"); @@ -813,15 +810,10 @@ static int s5m_rtc_probe(struct platform_device *pdev) if (ret < 0) { dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", info->irq, ret); - goto err; + return ret; } return 0; - -err: - i2c_unregister_device(info->i2c); - - return ret; } static int s5m_rtc_remove(struct platform_device *pdev) -- 2.29.1