From patchwork Wed Sep 20 18:47:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 113168 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1110209qgf; Wed, 20 Sep 2017 11:49:38 -0700 (PDT) X-Received: by 10.99.174.78 with SMTP id e14mr3063464pgp.155.1505933378702; Wed, 20 Sep 2017 11:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505933378; cv=none; d=google.com; s=arc-20160816; b=kGGLySfUf8H6af7YuOKj0EMVb4PhwxIhJgS9L5LBxiI9m1/A6hHPJ/8FJZjmbaqpOo x6aiVgN8MLQJYLZ5DdTJAWdNjKiDssRX29FUGhttzg5IPnjgbBHvPrApCVmdQTSOJQdi iAp0hFx2VGmsswUeppyea6Qr94aFUwvTRqsaS8l74gKwA29CFhDbd1W7QY332ytTnOC9 glUgyUlPvQhKG5kk8tZLKyObhF1vC0jS5B4yBZ3Vx5ugpio2jtX/2s71pivNgwTvk/9i 5d2k2L9dkpkRaJafpv4RkzwOxvcefG4r1fAASVfPp2sAuZ+kxLLqLlNTcqBFyKpO93TV 4+lA== 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=XliNWvY8GI0pgJNI2yvwGWTtPzFTbyJKDf+7IGFcrRs=; b=cnPDJmZeCrAQU2hyiY9JSSBxKFuXnHYm8JzDmZTloo8RFZ0OalIBb1sEu1QHf99vu0 fjii5KgRFIuHlpAziIH1IDNPUtaBj8ihsdtqXGLraSbtp0OkxG+yxiv9R7jrnhQGnmU/ baFCjvs1SMyzRWPnbAAtvjnz+qbi19TBTmlraTF46sa3HIlaqK/iUCAzfCAipO1G5a9X vnqhHR1HW4d926XvHnFnGooenxfdfb7jLC17WNlZAL32yRJRaGOY8y0nTVK84bbbnqgZ AoMFpMCqpitzB7ucAmdUyCX+ByHL7WqW0YaIgb6zy/4PBit8kTuDa7t7DQRIiUOqWdvo 2vwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FHKGOqDB; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (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 h129si3392743pfc.363.2017.09.20.11.49.38; Wed, 20 Sep 2017 11:49:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FHKGOqDB; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751521AbdITSth (ORCPT + 1 other); Wed, 20 Sep 2017 14:49:37 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:35302 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751367AbdITStg (ORCPT ); Wed, 20 Sep 2017 14:49:36 -0400 Received: by mail-wr0-f196.google.com with SMTP id n64so1974760wrb.2; Wed, 20 Sep 2017 11:49:35 -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=XliNWvY8GI0pgJNI2yvwGWTtPzFTbyJKDf+7IGFcrRs=; b=FHKGOqDBGGnUMoslWkxp1tTENiVhYOJezpGWC3aGqn0Cg6vBqotmARTb7T4Qs5IIeU brjA2k8/8hFl0JbEZC5rnAYQnO5w2OhEsvqHYwtPQCInkYxOUamhRoiASHfB4WA+/MBh ZTCmjIfn7bWUtRzWhQJB2YUbH1fTVRqFoTE0I2QF+IMLTDzFfeqN2qvlGK0Sv8XYwnNV EZ8tmMZAr2bDGJ1WHH88qM+rwFkrtIMpuuQZCQf26Zed9GtWfv0+dME/yS/JEc6ti0Yc O0C7I7WSbb1SVZnqYD8j7XmcnLwy3LNiheZ9Wf+rMtiURh7K6MO4gO3GYsy54M25zPzM OnVQ== 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=XliNWvY8GI0pgJNI2yvwGWTtPzFTbyJKDf+7IGFcrRs=; b=CSHmPj231+HfVnbuKeR8a9Rqx+etV69Wvn3A+dBIECxRwmjJehiW1yMWFsqc2wjk+2 Xg276UGFVXJLNsFKwo0fRU3Xk6PlCU+HeWlp8G6O7Xw1mRByPlOtyFRSe48PBMOecAMU Kn7EBRxcaeP7gOU1Ku/zz/LMlwLMabfY23xMch6KkfhtqPBAIjbNFCi2hZkuBe9AY22r p6GDJgdqfuTC2oRv8rA//6aEuTnhC8vrBvas3K4qxpkp/GVM/SYgwrg8XKEgkoVytoIK Oc8RzCgi4kGn+OxV+LntXj6ff1SnfF7ZkYTV7LBTily7kXcPvd86b9VCdiu8AxOiXuSS krPg== X-Gm-Message-State: AHPjjUg9sT5IjcWG5HimWr3DhQ+KHJLmqJxGGpTxR+MS2Yg7nRBAZPHo coKtWzfeUXU2nYI/AYQqSyfeIg== X-Google-Smtp-Source: AOwi7QABvWz64waVogLGRNoUlB8+zhYtkJgN2IG5joievoXql4tGScLCtjgoWhTLgmn0bkYCUagrDQ== X-Received: by 10.223.153.117 with SMTP id x108mr5008298wrb.202.1505933374985; Wed, 20 Sep 2017 11:49:34 -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 f5sm2258256wmg.10.2017.09.20.11.49.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Sep 2017 11:49:34 -0700 (PDT) From: Corentin Labbe To: herbert@gondor.apana.org.au, davem@davemloft.net Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Corentin Labbe Subject: [PATCH] crypto: bcm: use of_device_get_match_data Date: Wed, 20 Sep 2017 20:47:26 +0200 Message-Id: <20170920184726.22706-1-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.5 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@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/crypto/bcm/cipher.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.13.5 diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c index 537a67483aa3..92e97a6da811 100644 --- a/drivers/crypto/bcm/cipher.c +++ b/drivers/crypto/bcm/cipher.c @@ -4818,7 +4818,6 @@ static int spu_dt_read(struct platform_device *pdev) struct device *dev = &pdev->dev; struct spu_hw *spu = &iproc_priv.spu; struct resource *spu_ctrl_regs; - const struct of_device_id *match; const struct spu_type_subtype *matched_spu_type; struct device_node *dn = pdev->dev.of_node; int err, i; @@ -4826,14 +4825,12 @@ static int spu_dt_read(struct platform_device *pdev) /* Count number of mailbox channels */ spu->num_chan = of_count_phandle_with_args(dn, "mboxes", "#mbox-cells"); - match = of_match_device(of_match_ptr(bcm_spu_dt_ids), dev); - if (!match) { + matched_spu_type = of_device_get_match_data(dev); + if (!matched_spu_type) { dev_err(&pdev->dev, "Failed to match device\n"); return -ENODEV; } - matched_spu_type = match->data; - spu->spu_type = matched_spu_type->type; spu->spu_subtype = matched_spu_type->subtype;