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: 116612 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2938753qgn; Sat, 21 Oct 2017 10:47:27 -0700 (PDT) X-Received: by 10.98.63.213 with SMTP id z82mr8132016pfj.10.1508608047783; Sat, 21 Oct 2017 10:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508608047; cv=none; d=google.com; s=arc-20160816; b=oEOqzLjRi97AuFHf5HZeRczIy6oyUgHfKVVfHsd3PBMJuNHJWSVhI8ezsQl+DzH0FF AyHPd8LPwtOLINOJyBH3GpkRrRfk3n0yMyGi4DR1qoG6MgAudafGXYT33cMN45HmTWK5 QLq1Bva3bTSsewWs363ws4wfp8G2oSr+z2bvX2XgaChCLJo7gI4x3kSHWljvAqRF6rvV wLHdvVw+tCfV3vCsu3Oheg47nzw9Nu+Mq084qdJk0h/Pfdv4kOxZbMrIABojJEDkKtn1 2F3x9xC2oIGugWjD62nTX7tdCRjCuUPR8zNkSJPuqMmmNeO5w9DWwvwM4Ouv2mmapcKx Zsgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=DzyeK+jYtZ92yDiIEpCfAMmvU4m6FR00UXafQ4GGaMQ=; b=bD2+td8y5A+q3Fpz7gOVZByPY2dqtEx12me+DZ1ycmr+9pYyK0uogPdh2/Ev9aaaVf QlkzIZAd90DoRulAce3DvoRb8dYSFWLyjPlr2P6J3EfDWUMZO7gooeD5anDpWU9CVrV7 uO7tuhcW9d9WKwmsWdgWDHuIYd74JB5BgfFsYW48ar/EBK/RBRAaFXqZFSL9dnbZqHZb 86mp9pFAFhSNUOwY7Q13BvmXza8pgNUxwBp+3uXclYd80KFKzkbDQQOevKuGtbcRzd4q l3P92BjWWtBxh5NhTquvysdmMtWELGXOxyWMH4vjfFh8g6frAStbz8N9xI3v4XIf94kh P6ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=CRSPNTKn; spf=pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-watchdog-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s7si2449239pgc.415.2017.10.21.10.47.27 for ; Sat, 21 Oct 2017 10:47:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=CRSPNTKn; spf=pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-watchdog-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932208AbdJURr1 (ORCPT ); Sat, 21 Oct 2017 13:47:27 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:44801 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932179AbdJURr0 (ORCPT ); Sat, 21 Oct 2017 13:47:26 -0400 Received: by mail-wr0-f193.google.com with SMTP id z55so7684290wrz.1; Sat, 21 Oct 2017 10:47:25 -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=J+r3+8Su9FzCec0tBENSTX/SMwLqq7UMEZeONiSk0IQJR1Jkq+aStDo+kqkeL5fsDV RiSs8OdWmg5dwbklZS3eSNPKdvYILjl9wRK0cZqb4zWcKBysOQ8wLXBe49JooxFZ0tF7 xGhchAZ7WGHg4LJsblIvgXPlwMdQeknS1n6UmNX/ZMeQYn/ALtNSRiUc8Qk543cXknEi GPOCP8iAVdzwWdIgrSLIeF/h+yeDAMIFKsAcQvg8eOxKtGo/isNfn9eEuFb2N9qFPHDY 4a/BO6r4DE/LFrx651fDfSdjCfdOPC+A5uE537qYSyszU+Bk4Wdbqnf2k9EeyxtKFvdH Yzjw== X-Gm-Message-State: AMCzsaWNY5/ewYIc8WiL1CdvlhnVMIkBDRR9jHocb+6hZv+Y9RxDOpTF GvxKNu0CRK1ss/A53mM8DRc= 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 Cc: linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Corentin Labbe 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 Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org 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 --- drivers/watchdog/sunxi_wdt.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.13.6 -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Guenter Roeck 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))