From patchwork Tue Sep 22 21:48:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 7246061 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 67F389F39B for ; Tue, 22 Sep 2015 21:48:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B5DB209C6 for ; Tue, 22 Sep 2015 21:48:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 04F02209E8 for ; Tue, 22 Sep 2015 21:48:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5F6956E6CF; Tue, 22 Sep 2015 14:48:30 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from relay1.mentorg.com (relay1.mentorg.com [192.94.38.131]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6D8BB6E6CF for ; Tue, 22 Sep 2015 14:48:29 -0700 (PDT) Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZeVQK-0000UK-UB from Vladimir_Zapolskiy@mentor.com ; Tue, 22 Sep 2015 14:48:29 -0700 Received: from eyas.fin.mentorg.com (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.3.224.2; Tue, 22 Sep 2015 22:48:27 +0100 From: Vladimir Zapolskiy To: David Airlie Subject: [PATCH v2 2/3] drm: tilcdc: use of_get_i2c_adapter_by_node interface Date: Wed, 23 Sep 2015 00:48:11 +0300 Message-ID: <1442958492-6618-2-git-send-email-vladimir_zapolskiy@mentor.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1442958397-6497-1-git-send-email-vladimir_zapolskiy@mentor.com> References: <1442958397-6497-1-git-send-email-vladimir_zapolskiy@mentor.com> MIME-Version: 1.0 X-Originating-IP: [137.202.0.76] Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This change is needed to properly lock I2C bus driver, which serves DDC. Prior to this change i2c_put_adapter() is misused, which may lead to an overflow over zero of I2C bus driver user counter. Signed-off-by: Vladimir Zapolskiy --- Changes from v1 to v2: - none drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c index 354c47c..4dc78c7 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c @@ -348,15 +348,13 @@ static int tfp410_probe(struct platform_device *pdev) goto fail; } - tfp410_mod->i2c = of_find_i2c_adapter_by_node(i2c_node); + tfp410_mod->i2c = of_get_i2c_adapter_by_node(i2c_node); + of_node_put(i2c_node); if (!tfp410_mod->i2c) { dev_err(&pdev->dev, "could not get i2c\n"); - of_node_put(i2c_node); goto fail; } - of_node_put(i2c_node); - tfp410_mod->gpio = of_get_named_gpio_flags(node, "powerdn-gpio", 0, NULL); if (IS_ERR_VALUE(tfp410_mod->gpio)) {