From patchwork Sat Oct 21 17:45:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 10021471 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 E11B260224 for ; Sat, 21 Oct 2017 17:47:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CED3E2882C for ; Sat, 21 Oct 2017 17:47:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C37B328888; Sat, 21 Oct 2017 17:47:54 +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=-3.7 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4D1932882C for ; Sat, 21 Oct 2017 17:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=CC+NWPRhORx5UIH57e2Mv8JiM97484hLsWeKFsrv3oo=; b=I7S SKZpKQe8tnOY47mA7P3LvZQ9xZg/Wv+v1sIsduHPApphKKTV46RC6m95ZrNZvwLll+tFrRyFAhzkw Z56FdjFBXGiioEl3pj9gMx7rvkmZn6KCeePu48k7+N8G2/ZxbAI5mdNOBPmPYUpWMkkQqo1mX0bRg gxGJrOMsJ+tzY0OOs5Z3wDVMu1FR0SIbcYVUIVosMVWaxEqxtkJ6loSif/ymKoUV70fifZDbO3HcJ G8ecTFn/i2oqepdnW4UOSYUzhLDzTb5lUljCYGeGhf5SJxpKKedEKsczt/pjsCaPNkA82F/jTh5mc BdoSfMAr0FV2xMb19gfJ2DV+99fq3Jg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e5xsE-0006y2-Ja; Sat, 21 Oct 2017 17:47:50 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e5xsB-0006tb-Gs for linux-arm-kernel@lists.infradead.org; Sat, 21 Oct 2017 17:47:49 +0000 Received: by mail-wr0-x244.google.com with SMTP id y39so13753762wrd.4 for ; Sat, 21 Oct 2017 10:47:26 -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=q78ygZWV67WY2+zPbcCAhTuNgySXDzlQeYFu51eIJBM=; b=CRSPNTKnYK/A0wU89ogDX3BSCeSVT8vqWed8ZO57KbVYQXTqNc3H8NGio8w740MLJE xi+Ea9JPr8nzDSoeqri3/peJq3Go35YrNVo5ZnEhpw4IBJ2DsrpUakA0fULE5cQzDZPd Ilz6cxnaeN18dWccKs8VgxFDeGSGsTS/PRoMR1WZPh5D9LyfAEpRD83j0AstF7/WXkhO sAFdAir6TWXqTBGE5v32QWVvDGjSjBXlJJq9wS1Cwh80m+RpM4W2aEfFUNnOb0ZPsLlc jmxb3PSaLP6NMmqHnKtiYJAYrfa7BnaS2bzbyH92J6lpGwwa0MwroWgf7+9YJ2SW1rWw FhRw== 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=q78ygZWV67WY2+zPbcCAhTuNgySXDzlQeYFu51eIJBM=; b=XDuTwFqdODSruw6IEO1277d+8jpnNJ31P9r0W5wsm3rxXDl270PMvZ3eKIoJm/8nzv 36AUR4x0madYZKtBSWfu+/MKZkwPetXOz6C9DJKxtGanOt0mn1LqtNxgOqxgN+9RL2YG KIUjKUOYdCM3wh+pLnto9ykb62fsNFWQ40nZlYkRy5Hg3R7SuQR/BT76FFWvtez/0jWe 1m/adS8FHzRs77dKcy3/XtDjr5rWzTBArhyr9TCA52VjWacNxXkCNulOJpslHaW0by19 GTYtYTilD/j5Ex5cuyHX0xCZIRVAgWlcQTdmphjm4qz+RRQNwywqxipwwM3ugSfi7cpV RHew== X-Gm-Message-State: AMCzsaUvd1WViHPOfxtuqyJlDvb5K+At+sRtYN56HzpU4ECA15J30Zwy 9AQTpDeCFQhrYws93AGwDwA= X-Google-Smtp-Source: ABhQp+SUdoZGfL044nsdT4BoQcMQwTpiEyMivgF2A4beiDrB2pBB4gxc0gmu499FXTdzZ/Tjt3z7aQ== X-Received: by 10.223.135.231 with SMTP id c36mr7664551wrc.248.1508608045083; Sat, 21 Oct 2017 10:47:25 -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 k130sm4229880wmg.12.2017.10.21.10.47.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 21 Oct 2017 10:47:24 -0700 (PDT) From: Corentin Labbe To: wim@iguana.be, linux@roeck-us.net, maxime.ripard@free-electrons.com, wens@csie.org Subject: [PATCH] watchdog: sunxi_wdt: use of_device_get_match_data Date: Sat, 21 Oct 2017 19:45:13 +0200 Message-Id: <20171021174513.1653-1-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.6 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171021_104747_729186_CD20C151 X-CRM114-Status: GOOD ( 10.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corentin Labbe , linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 Reviewed-by: Guenter Roeck --- drivers/watchdog/sunxi_wdt.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/sunxi_wdt.c b/drivers/watchdog/sunxi_wdt.c index 9728fa32c357..802e31b1416d 100644 --- a/drivers/watchdog/sunxi_wdt.c +++ b/drivers/watchdog/sunxi_wdt.c @@ -234,7 +234,6 @@ MODULE_DEVICE_TABLE(of, sunxi_wdt_dt_ids); static int sunxi_wdt_probe(struct platform_device *pdev) { struct sunxi_wdt_dev *sunxi_wdt; - const struct of_device_id *device; struct resource *res; int err; @@ -242,12 +241,10 @@ static int sunxi_wdt_probe(struct platform_device *pdev) if (!sunxi_wdt) return -EINVAL; - device = of_match_device(sunxi_wdt_dt_ids, &pdev->dev); - if (!device) + sunxi_wdt->wdt_regs = of_device_get_match_data(&pdev->dev); + if (!sunxi_wdt->wdt_regs) return -ENODEV; - sunxi_wdt->wdt_regs = device->data; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); sunxi_wdt->wdt_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(sunxi_wdt->wdt_base))