From patchwork Tue Feb 7 11:05:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13131387 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14CDFC64EC4 for ; Tue, 7 Feb 2023 11:05:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231907AbjBGLFs (ORCPT ); Tue, 7 Feb 2023 06:05:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231906AbjBGLFr (ORCPT ); Tue, 7 Feb 2023 06:05:47 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26B1B10412; Tue, 7 Feb 2023 03:05:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1675767945; x=1707303945; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Sxq67FeXQXAnYaAAfQI0Uzka6QtNMDvnqpC7ftxQm40=; b=Vo+E9GPmH3bYsHrB1UIFXtawAt6V0ib7MnkHlX64w7gt4IxQW5354Nz3 MxAmLKv38YjMigeHU6nI3Hl3BmVy4tuWsIfr/mCsqL2XTQM9obifx+JHu PPMzebZpj4PlErInAxkQI1e5K+Pj/xazpycTz12aEkWmgkXqaphFnSKWA BBX9J+BsF1An91o4SBd6cCeKu/5Metg6jNlSvRZ7H1lCn1dZXyD22wM2w 9sVMAR5ri3XJ6mWcBXtj4vQDIlNsjFnu/XAHXLaytxieMmlrtDH59fJ/T BCXRiumB5Mqo17pC7aWLeRP47g3G/cgPZb61Y9RF5ekclakeDE0QI0fSP g==; X-IronPort-AV: E=Sophos;i="5.97,278,1669071600"; d="scan'208";a="28917150" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 07 Feb 2023 12:05:41 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Tue, 07 Feb 2023 12:05:41 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Tue, 07 Feb 2023 12:05:41 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1675767941; x=1707303941; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Sxq67FeXQXAnYaAAfQI0Uzka6QtNMDvnqpC7ftxQm40=; b=exjsP5avprf8yzYtl8GHYaavpCnNzrOBP7ST05M7N00Gwcmq67D7QgYE uPEQaNuC2tvP86Mb/BYe2A5Bed0QSAi7cY6Umnwx4BZSnC0XLWHPPZOlj uWm1WX6febSxtyf6OdnfP7zUDJZnFT04958v5+p6weCMyaGA+HJdFLGzl cgWcVZzknXwFb4BJWYjqX4x6lgLnFz9R/e1B+Hl3fK9YJSZIHA3S/ceSV difpxd2MBxQr2/lDWsNwx/TSY58azThlrYwuWqqaO9mN78oOfL4g8T/gX zsHAOS4Sq3nT/N2tJielyHa1TFgXGizI7/liadMdcidpjpMtD4DyNXM9v A==; X-IronPort-AV: E=Sophos;i="5.97,278,1669071600"; d="scan'208";a="28917149" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 07 Feb 2023 12:05:41 +0100 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 830D8280072; Tue, 7 Feb 2023 12:05:41 +0100 (CET) From: Alexander Stein To: Rob Herring , Frank Rowand , Greg Kroah-Hartman , Alan Stern , Darren Stevens Cc: Alexander Stein , devicetree@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 1/3] of: device: Ignore modalias of reused nodes Date: Tue, 7 Feb 2023 12:05:29 +0100 Message-Id: <20230207110531.1060252-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230207110531.1060252-1-alexander.stein@ew.tq-group.com> References: <20230207110531.1060252-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org If of_node is reused, do not use that node's modalias. This will hide the name of the actual device. This is rather prominent in USB glue drivers creating a platform device for the host controller. Signed-off-by: Alexander Stein --- drivers/of/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index dda51b7ce5970..5b929351b65bf 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -256,7 +256,7 @@ static ssize_t of_device_get_modalias(const struct device *dev, char *str, ssize ssize_t csize; ssize_t tsize; - if ((!dev) || (!dev->of_node)) + if ((!dev) || (!dev->of_node) || dev->of_node_reused) return -ENODEV; /* Name & Type */ @@ -376,7 +376,7 @@ int of_device_uevent_modalias(const struct device *dev, struct kobj_uevent_env * { int sl; - if ((!dev) || (!dev->of_node)) + if ((!dev) || (!dev->of_node) || dev->of_node_reused) return -ENODEV; /* Devicetree modalias is tricky, we add it in 2 steps */ From patchwork Tue Feb 7 11:05:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13131388 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1630FC6379F for ; Tue, 7 Feb 2023 11:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231917AbjBGLFt (ORCPT ); Tue, 7 Feb 2023 06:05:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231909AbjBGLFr (ORCPT ); Tue, 7 Feb 2023 06:05:47 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C1C9DBDC; Tue, 7 Feb 2023 03:05:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1675767946; x=1707303946; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xF4jDpA9qmX+Mr6H3ol1SyoP+RukmcdTgfZeN+x6MrE=; b=F1tsRY8x3EI3mP+aJLHj5Pvf1uhRrDNXwX217SRNzmBwns4h2Wxq94TU yl0EISBmbBtMSmaRmb03MFusbkl+hWN+f85wOnR0DHUDshx4/OxTGeO2u gfbhrAGwOlAaOTAvd/Q+0kyxXKDWUuftSHKCcdLkWwahX/ojzagS4hGy7 hOV0ARGDEmdirZqWaMJt4fKNkBEca85IkR8Tm+Qy7HV7KtU+ln61j8oV8 E5geszLcb2McNVfGWYTu4qfz2x4o6rOEYcK006CkRgWOa1vtwkVGOQj7M y9YS2jtBIEQcW1kdRgNW/URlWviRJYTjOkaDuBj64T4JJERjRSyixZ1SS Q==; X-IronPort-AV: E=Sophos;i="5.97,278,1669071600"; d="scan'208";a="28917152" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 07 Feb 2023 12:05:41 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Tue, 07 Feb 2023 12:05:41 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Tue, 07 Feb 2023 12:05:41 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1675767941; x=1707303941; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xF4jDpA9qmX+Mr6H3ol1SyoP+RukmcdTgfZeN+x6MrE=; b=bbQFVAauNtA8AcSz8nEsemS4XavL3lLNVVjyaOTy/kFvwRPlwU+NhL2/ k3jLhYq+9XbnbHqlZLpaIIBttvm7l1Kb3Heqi7/bKreB/hTw6YcVGmZAX 1rWuDRaZJVyNRak+5Mc+f1xjAGWQLTa1ZMY+BS4emO2Kj1IrlXDCHKwXT DONSdq56DkthPRZtQb2VB60aXjbq83Bwgb2di/9BamukXoDZVVPDY3xaV zR5yIHWuoQn+Wqi8Tnil70SAYZU8qpERMhetuzJePRfpI2PDngESWJF5d 55shciw0K12jk53nrkATRRCXxk5KGJ6ek2XKNz7KpMbC9bZMf5TBkgAUk A==; X-IronPort-AV: E=Sophos;i="5.97,278,1669071600"; d="scan'208";a="28917151" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 07 Feb 2023 12:05:41 +0100 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id ADC30280073; Tue, 7 Feb 2023 12:05:41 +0100 (CET) From: Alexander Stein To: Rob Herring , Frank Rowand , Greg Kroah-Hartman , Alan Stern , Darren Stevens Cc: Alexander Stein , devicetree@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 2/3] of: device: Do not ignore error code in of_device_uevent_modalias Date: Tue, 7 Feb 2023 12:05:30 +0100 Message-Id: <20230207110531.1060252-3-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230207110531.1060252-1-alexander.stein@ew.tq-group.com> References: <20230207110531.1060252-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org of_device_get_modalias might return an error code, propagate that one. Otherwise the negative, signed integer is propagated to unsigned integer for the comparison resulting in a huge 'sl' size. Signed-off-by: Alexander Stein --- There is no problem if of_device_uevent_modalias uses the same checks as of_device_get_modalias, but this is error prone and cumbersome. drivers/of/device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/of/device.c b/drivers/of/device.c index 5b929351b65bf..955bfb3d1a834 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -385,6 +385,8 @@ int of_device_uevent_modalias(const struct device *dev, struct kobj_uevent_env * sl = of_device_get_modalias(dev, &env->buf[env->buflen-1], sizeof(env->buf) - env->buflen); + if (sl < 0) + return sl; if (sl >= (sizeof(env->buf) - env->buflen)) return -ENOMEM; env->buflen += sl; From patchwork Tue Feb 7 11:05:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13131389 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF84DC64EC5 for ; Tue, 7 Feb 2023 11:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231920AbjBGLFu (ORCPT ); Tue, 7 Feb 2023 06:05:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbjBGLFs (ORCPT ); Tue, 7 Feb 2023 06:05:48 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A17E38675; Tue, 7 Feb 2023 03:05:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1675767947; x=1707303947; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AFsWSeYAageVMgP2N8c94C1DwB99H5I9X+J2x2OKYVg=; b=d2dmWsMVUvVa/yV70sSu+0MQKMWajnt6cNnLunJYWzBRpVVNPbqyhNf+ EOWjWiKBdEi9wMXh6uj+avCfRmE3+gBOzjwMIt5maHnawJzct//6EVNQG rXxtt+KiUyg1bG0ounaUOxY757kVVaVEoDnJTQzpkDwoY4kWIUgKQTlN1 bIb5cS15yxhPrkktAWDDU0g4eI/7rG3L/sQ3rjT6M005ShB1q8r5MaVJ0 r5U4M0Mkaa8eQrKQ9ggRddhg/YnSmF6g+gmYn7C462aHoBZePuCkh0A7N O1adZ2ZiiJPN3yQANOAohG+12BvzY6mZgEqWfwNWRVf7RUGip1KDNYWfY w==; X-IronPort-AV: E=Sophos;i="5.97,278,1669071600"; d="scan'208";a="28917154" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 07 Feb 2023 12:05:42 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Tue, 07 Feb 2023 12:05:42 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Tue, 07 Feb 2023 12:05:42 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1675767942; x=1707303942; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AFsWSeYAageVMgP2N8c94C1DwB99H5I9X+J2x2OKYVg=; b=Jksy4O/LzXZHSJYXuHs9hyyMVNFHu8XCiba0vuoCgk0jkBKJFmRsrmPz 4YTrGkaxUhQBqwMdDWVBbA78AVsoKRtBBtGDM9fkP89z1fkoNgeowdxI+ 3flbn8UF5rgBgtFDCXG6Eupnyf09EUVOOq7ohZT/FHgng5DBJTwWpFoK9 rplYv9dPGJGsYtNpY9aZVQTTYHZpG/bP5R/LJWPHEUng+blqxWtfc+Zf1 DXRheAY+IfgvHRPiFAF8B+Xh0MO2Sd7sR7HnE9bSHgki3gSk1+R8QWyxn 1r885BtotPJJM6nkGmREEpcC2aKa4L6zFBNHI1KsCMS00li9gyRRUekNP Q==; X-IronPort-AV: E=Sophos;i="5.97,278,1669071600"; d="scan'208";a="28917153" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 07 Feb 2023 12:05:42 +0100 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 001D1280056; Tue, 7 Feb 2023 12:05:41 +0100 (CET) From: Alexander Stein To: Rob Herring , Frank Rowand , Greg Kroah-Hartman , Alan Stern , Darren Stevens Cc: Alexander Stein , devicetree@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 3/3] usb: host: fsl-mph-dr-of: reuse device_set_of_node_from_dev Date: Tue, 7 Feb 2023 12:05:31 +0100 Message-Id: <20230207110531.1060252-4-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230207110531.1060252-1-alexander.stein@ew.tq-group.com> References: <20230207110531.1060252-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This sets both of_node fields and takes a of_node reference as well. Fixes: bb160ee61c04 ("drivers/usb/host/ehci-fsl: Fix interrupt setup in host mode.") Signed-off-by: Alexander Stein --- drivers/usb/host/fsl-mph-dr-of.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index e5df175228928..46c6a152b8655 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c @@ -112,8 +112,7 @@ static struct platform_device *fsl_usb2_device_register( goto error; } - pdev->dev.of_node = ofdev->dev.of_node; - pdev->dev.of_node_reused = true; + device_set_of_node_from_dev(&pdev->dev, &ofdev->dev); retval = platform_device_add(pdev); if (retval)