From patchwork Wed Sep 20 07:24:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9961025 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 575C760234 for ; Wed, 20 Sep 2017 07:26:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A56C28FDD for ; Wed, 20 Sep 2017 07:26:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F65928FE0; Wed, 20 Sep 2017 07:26:41 +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 9E25F28FDD for ; Wed, 20 Sep 2017 07:26:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751826AbdITH0O (ORCPT ); Wed, 20 Sep 2017 03:26:14 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:36846 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751809AbdITH0L (ORCPT ); Wed, 20 Sep 2017 03:26:11 -0400 Received: by mail-wr0-f193.google.com with SMTP id g50so960332wra.3; Wed, 20 Sep 2017 00:26:11 -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=M7Yy/2eQ20QJNtbO7xTD0QddHArKQeZySLc3vaLUwFQ=; b=scXJWxeb2yaxC54Eqty1IuZzHFMu+Sjj1zqkvnNV4iITWNMUmpml/ey5uKqzIVvqol HPRwPbLnVTYTVCv0kh5TyuYHA+wUjpYdxVIWpM1d18+RMtvoceLBAiuuRuhngCec0+dR SrngUlceRviYKuTx6MwkECNTULDbJinR78iwTiAFHSnEN+JmcfhYHT0/7WNbCl46xuyu SWB8Al/7dXB0EyyIXkAvD876YHTgwLdnDG+wTdbMK5Cz8WpdhJL6SoBxFiDmbsN7rX1K Z2RZd7BPL/J1mkcSEQ7veqr1pL7b++A4C4zWCU2/8OsWnZ+snNdFnaFbt3PBsT53hC5+ 85tQ== 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=M7Yy/2eQ20QJNtbO7xTD0QddHArKQeZySLc3vaLUwFQ=; b=KmVaV+Mj/a5zjLU8o/XKfkdF6UukZBmZjcmkZ5RFrK7X3cCD7FXEJKnQUR/3DJJ9tJ T904r8Ql6G7bNsJhzxYS+FENLSxgNDGZau5QPFqkpQZr+AqKpEQ2Z00QAPrIVxZe0yO4 UGETgprFjOWYwifL2jH1MEPpOROhpvFoFfGb4odx6fPjDOaDV4eaxm/lWvOvy5a/sYmu cmAI7PR866VGe+hkPUCRkLOshn7WJz6rbn/vw7tdImsZ0QV2TTMnaKDE3hLp5OKKPEdb ZbjZzhxvTKV/R9AWQP+2rh5cwYGVu1ml49iRByPxj6mbx6xkt7GqcmmseWcaIPqNa8er rScg== X-Gm-Message-State: AHPjjUgeoL0uckgkIjOo458jvfBsiUC8c0GUNHiOTNhZSuErLlJbJFKB QYw9y1vBsGGK6XXjvnZ8SJQ= X-Google-Smtp-Source: AOwi7QB9SA79MHvgBiMorZzsEA2OBUlzWPaI0l7QmYlyQhNB9GjDtzs2SHhbyrDWxzcMSp4FjF3CUw== X-Received: by 10.223.159.77 with SMTP id f13mr3780251wrg.154.1505892370506; Wed, 20 Sep 2017 00:26:10 -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 4sm995012wmg.20.2017.09.20.00.26.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Sep 2017 00:26:09 -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 v2] dmaengine: sun6i: use of_device_get_match_data Date: Wed, 20 Sep 2017 09:24:02 +0200 Message-Id: <20170920072402.27704-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. Acked-by: Maxime Ripard Signed-off-by: Corentin Labbe --- Changes since v1: - fixed commit title 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);