From patchwork Wed Apr 4 10:23:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 132805 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp4874822ljb; Wed, 4 Apr 2018 03:24:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+5gXidfchccSFjowG2N+JXsbLhsTE5a6ywbTUgul1vz9GCns0RpBQhMwVIMMYaA2ik2kay X-Received: by 10.99.152.68 with SMTP id l4mr11385544pgo.75.1522837476112; Wed, 04 Apr 2018 03:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522837476; cv=none; d=google.com; s=arc-20160816; b=0LIYCMfBnLOQHN6Ni/qy37fbOJQ9OKQS/0njvFouH2xoox1UXGYLZbu/mXg4KN6mCb GpPNXBNmlios5OUuXZXrQf16Dkq6RXHVkZ9tSjUXA3HQXQIbKnALmoVpX4SI9tsIfeXl ThB+nyWq+1MBCpl/dK2blBYqsWbPSlJ0eMWBc0OWIyWNuAX991k/RK/ldmaxPVHzcObE 13+pLfMWd9G7SnJpTYXY9+dOA900SBSy8SdWT47JhKSimxrmXwv03/mBfZ71hWQ5Y99s XU7F9cl48mRrICvmXYUNpiI5CzTJZ5qkuV9tHuta3wVDJZwzZsFfInGu4GxbpKkYYecg SpQA== 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 :arc-authentication-results; bh=TfvGaV6Tn54W984CXzMmvQ11LktdhsFrkOfFsiS9RoQ=; b=0HHhpaiLUfZstJUMCgFcE6rcP5L6SjxN64ADhLOQLx/2UwOezFTvJFpcJL8hzsmiGZ Csb+3tTOjJpNShrF7bKdHOkEaM+AoV1RlCBJWB3n7UsKakJiXYgQs2a80LxqLyQodDpM ibwQ6jxh5Gzw1zI8mKJI3GRrWUAmoA4DjSSKUhFKuFwT5qRmAsDhj0o0ygLb47QaeBxB g3HFNGHnPRo4zxAko5xbEAVpLrXvB0hYZod0rMuTRlBaFzeEqH7O4s2dTXXrUCHZN81C xgIntMJOnvQTsmFl5R2oN/AyigJwD08znhncT0jtylDJFUNVRMD+v/lnzzHy7JDA0RQm 0+Ag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h13si1906554pfi.192.2018.04.04.03.24.35; Wed, 04 Apr 2018 03:24:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751362AbeDDKYd (ORCPT + 29 others); Wed, 4 Apr 2018 06:24:33 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:54457 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751017AbeDDKYc (ORCPT ); Wed, 4 Apr 2018 06:24:32 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lr24R-1eZZZ21QXr-00eaM9; Wed, 04 Apr 2018 12:24:03 +0200 From: Arnd Bergmann To: Joerg Roedel , Heiko Stuebner Cc: Arnd Bergmann , Jeffy Chen , Robin Murphy , Tomasz Figa , Simon Xue , Marc Zyngier , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] iommu: rockchip: fix building without CONFIG_OF Date: Wed, 4 Apr 2018 12:23:53 +0200 Message-Id: <20180404102401.3634085-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:7CmUPavO3w1gNayRTTinbvsD5Hwunayj36eLBmr1zHhRH1ejn4w obFJth4IhGTL7uSaBD8/qipw+71XqPckzNnJdpNvqi15Zr0Dg+xXAnh/7GzOvAvkaryWnho FCWG/f6FReptov5LiQVDo9bW3+KDhQZMu8KKdrYfTx17dhRQ53rPoU+XpZ/54b6Oou9TVLS k8yDjPTxB4W1nsStolNdQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:ZWoxCgApfZk=:aRqQG8UVibrgDW9/KcBJUZ i4ROiA1cWmNvCgui6/RDAtsi1ULIBOY5Y8ueW8qgGmDw8UueSE+MgAxfWgZAS42LJtSQAwVJT SwqnL1GBYlh6XyCNdFC38wKQxXoBaflhDSewJgYl9bv+Jzew0xase0aK3uzHLrBOwYdOP9R00 liVNcIUVRPvNWd5uTrBAzfG2gxqANqG5TTkqRmi0dg263260ytuntVFfEJGK7FcRuCxdNsizu hBVZBY3KE+Iy+690qR1bgvIROTcV+3B95Ja76017fFBye8M3474fBFzT5uvVmCwcjQWw/BWSf DEpBVKdGZS7ChXbfDKXPuEsbLh+MZyT1r7OkwrCPgMpRp4tYSupXd1dYQgxqSw8aoJN/hNJTX Dx0O+FeyGoswyt5wJ9zU96tiFJrB/b23ncQdE/o5yZt9/wG2ynACov5meyPU2dFf6JDHCXvmG M9Pduu0LraX1GTSXRxwcRlx1P6uPURlQY6ddOMzSojofNrkJe4BC4ZhhZ3Xp42NxeShovJlgl y/jH5YzQfeEmFB5wfHtpmO4shjZucvNOF/zNYJf231W9XGrTrdfrGwEb4WJ4cZjp16JheHwRX tfgiSx14nz9+WZxT4CovQNEruhtGL5BzzpWkx01QLgyXeb+QwUwpjWorc47700+S/CWYG4nuF fvcYA3GxJsa5Ee89VZmuqIrhk7twsRRLJuFy2RNO/5koIXWWAvNTwiN0Chq/yNiWCrsxT/kaw AkPrcxiuoFLp68xPDiEhOkKT+Bi+NB1q2r+EXA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We get a build error when compiling the iommu driver without CONFIG_OF: drivers/iommu/rockchip-iommu.c: In function 'rk_iommu_of_xlate': drivers/iommu/rockchip-iommu.c:1101:2: error: implicit declaration of function 'of_dev_put'; did you mean 'of_node_put'? [-Werror=implicit-function-declaration] This replaces the of_dev_put() with the equivalent platform_device_put(), and adds an error check for of_find_device_by_node() returning NULL, which seems to be appropriate here given that we pass the device into platform_get_drvdata() next, and that of_find_device_by_node() might theoretically return a NULL pointer. Fixes: 5fd577c3eac3 ("iommu/rockchip: Use OF_IOMMU to attach devices automatically") Signed-off-by: Arnd Bergmann --- This warning appears to only have been introduced in linux-next after the merge window opened. --- drivers/iommu/rockchip-iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.9.0 diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 5fc8656c60f9..fe9c9cc1a9d4 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -1094,11 +1094,15 @@ static int rk_iommu_of_xlate(struct device *dev, return -ENOMEM; iommu_dev = of_find_device_by_node(args->np); + if (!iommu_dev) { + kfree(data); + return -ENODEV; + } data->iommu = platform_get_drvdata(iommu_dev); dev->archdata.iommu = data; - of_dev_put(iommu_dev); + platform_device_put(iommu_dev); return 0; }