From patchwork Tue Sep 19 18:44:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9959955 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 4878360568 for ; Tue, 19 Sep 2017 18:47:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FDBB200F5 for ; Tue, 19 Sep 2017 18:47:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E38B20499; Tue, 19 Sep 2017 18:47:22 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 C4BC7237A5 for ; Tue, 19 Sep 2017 18:47:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751462AbdISSrD (ORCPT ); Tue, 19 Sep 2017 14:47:03 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36917 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751502AbdISSrC (ORCPT ); Tue, 19 Sep 2017 14:47:02 -0400 Received: by mail-wm0-f67.google.com with SMTP id f4so431710wmh.4; Tue, 19 Sep 2017 11:47:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=8btbBxIkhrvn44g9b2hNQpUyUTJgUgfPExMhKcCZE2k=; b=Ts+AeAX2Y7GYbJIbUsX5qiPhk3Et1f/CSEZkF3mo0SJa5E0iS9rRopqRfHibojPsYW RFpk5nkOYIsGlmwwFn/G88UocA82e+hTEKLoFnQbeYdBz4ieAas3tZwN4fVQK7HkRbAu 9fPy9BI6Dd862UQnfoSaWsaXzHut8azFAedaiuO/WolJmgyMxL1CjJfww+mSca1cJMCf /uZjpSnGcB+a5pmqKSQivX5jEzE6QjVuh1yicRh7YlEGQkSV695M7K3HB+k0zQgKmtjl D7wgMsk5QmV1s4ApucYFZOVS7J/TRe5q2pt9HoYJy5368vC2lMdo04ufe2/0o90CkKQE 787g== 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; bh=8btbBxIkhrvn44g9b2hNQpUyUTJgUgfPExMhKcCZE2k=; b=G/lFrnpDTEkqgxd5w1B16SxNPI/LBSaVTEGFHqkTlS5zrRWxwzwaBOAWTU7awJaTUK pYW+nXQyWZDbM66Yinn4ANm1raeXcJ2rSD6Yuypx6f1ZkKxm6HmaI3yneOZGqR3bZ8Tc W4f2FiIQd+M4R96grsmFTuni0yY9KObdcEUREWQTN3Rp0KW/+uYa0oH3drk4VdigrL0A 3qDucjpwsjJRf8jRx6OyKD7ax4gk0BV0nHnlDnr9H3ikk7k8hTDJTUfhOjBfCaHNURUa XqccI88a/LvFHfjKtbxOpQOeiDFUH9QyksYmiAZdI9YMOxLJSnDDmYuji/xBdc8S/U+Y jY8g== X-Gm-Message-State: AHPjjUis41PKT1SfbMG0MIB2ZgkAFQ/SAkIzdKAZb1q+uh2kOtrFQwIA CnHwfaiL6J8dgL0ha80TGsM= X-Google-Smtp-Source: AOwi7QAWnDvaqVoPq5QSdNjXB5QCAj//zAnHAtf9z5RKtJHVHZAxfWc2TlTJHupfhnQMsZ2ApQBI/g== X-Received: by 10.28.223.87 with SMTP id w84mr2049197wmg.148.1505846820961; Tue, 19 Sep 2017 11:47:00 -0700 (PDT) Received: from Red.local (LFbn-MAR-1-580-96.w90-118.abo.wanadoo.fr. [90.118.159.96]) by smtp.googlemail.com with ESMTPSA id f43sm12665470wra.79.2017.09.19.11.46.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Sep 2017 11:47:00 -0700 (PDT) From: Corentin Labbe To: vinod.koul@intel.com, dan.j.williams@intel.com, maxime.ripard@free-electrons.com, wens@csie.org Cc: dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Corentin Labbe Subject: [PATCH] dmaengine: sun6i: sun4i-gpadc: use of_device_get_match_data Date: Tue, 19 Sep 2017 20:44:47 +0200 Message-Id: <20170919184447.4479-1-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.5 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The usage of of_device_get_match_data reduce the code size a bit. Furthermore, it prevents an improbable dereference when of_match_device() return NULL. Signed-off-by: Corentin Labbe Acked-by: Maxime Ripard --- drivers/dma/sun6i-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c index bcd496edc70f..584f4e82a9be 100644 --- a/drivers/dma/sun6i-dma.c +++ b/drivers/dma/sun6i-dma.c @@ -1064,7 +1064,6 @@ MODULE_DEVICE_TABLE(of, sun6i_dma_match); static int sun6i_dma_probe(struct platform_device *pdev) { - const struct of_device_id *device; struct sun6i_dma_dev *sdc; struct resource *res; int ret, i; @@ -1073,10 +1072,9 @@ static int sun6i_dma_probe(struct platform_device *pdev) if (!sdc) return -ENOMEM; - device = of_match_device(sun6i_dma_match, &pdev->dev); - if (!device) + sdc->cfg = of_device_get_match_data(&pdev->dev); + if (!sdc->cfg) return -ENODEV; - sdc->cfg = device->data; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); sdc->base = devm_ioremap_resource(&pdev->dev, res);