From nobody Thu Jun 11 18:58:26 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEF7C34CFD0; Wed, 13 May 2026 22:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778709825; cv=none; b=UNkMkplTkYuoJ203zTYNjEEZgUrqFGNPY6hcxgSxnm9bgJvU6/Kw8pVBpDlknd5GFMruZaVr91ox0C+sP6NjtXC6hjUbzF7xnRXFNmGmgI/ql2wzVhlhyFZcDClEgjm3rMPsJB9f8eBUdSaM5/1Jlu9+54r+XRb9gMVVZVGsXs4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778709825; c=relaxed/simple; bh=dwFBnLXsBSJhM0CEDgNPKRthY1LonLKx8Vv5G4u3TV8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gggleze/y/sVYAWSmzZomdmdQh0vATcCztJ+IOpSpr5MgfK1tid4n42eohiM4Lv5HkTo7+yc9yhMMTgTO7JmCchhbTlm+ExfwcPczqOy4kjDP9RotMbaZHVtfbcrDdPwHQ/by/WlCEyAnY6tfTmjw4LcD6ZS00sU3sIHgZIqGEw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=NLsQAzn/; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NLsQAzn/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778709823; x=1810245823; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dwFBnLXsBSJhM0CEDgNPKRthY1LonLKx8Vv5G4u3TV8=; b=NLsQAzn/HFxZdNKAqqGSNXJ05VvlnHvmySNNDP5OniVgi0qafXXSkSH4 mrXtFsaO3d/2qSsf+CwxHo+jTxZid+FcAAvPyZR6DBpz22/z1pmxiZLxM o6rgREP/q+sKqCAY6KgzoBb5kMeB3bvv5BDf1uGMY5j3Phrj80g8O4hvQ 6igiW19EjqXaUVcuqLSINMeRnofgoiTJnyIyffA6vZBcR3Hz7gSwpXM2W B7E2sxDL/tIM0Ti1VGkvfLE5kcjDxabetzKlxl+oi9Irjy3kH1Xepzju1 FCet0kEPxMvSKSfYPKeKkMmCkLOu0vnzXPrSym5I0qUm/8V7agFRmA5T3 Q==; X-CSE-ConnectionGUID: N+nTQ9VaQou7QOweRV9J3Q== X-CSE-MsgGUID: Pl5gOI+2TvOOC+auZ1Yoig== X-IronPort-AV: E=McAfee;i="6800,10657,11785"; a="79600738" X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="79600738" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2026 15:03:42 -0700 X-CSE-ConnectionGUID: HXaP3u2zSlmHvqU9Upj2Rw== X-CSE-MsgGUID: VQ9ATF74QHWiC3PJQYuEQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="238447029" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa007.jf.intel.com with ESMTP; 13 May 2026 15:03:39 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 93CBA98; Thu, 14 May 2026 00:03:38 +0200 (CEST) From: Andy Shevchenko To: Peng Fan , linux-can@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marc Kleine-Budde , Vincent Mailhol , Vinod Koul , Neil Armstrong , Josua Mayer , Ulf Hansson , Andy Shevchenko Subject: [PATCH v5 1/6] phy: phy-can-transceiver: Check driver match and driver data against NULL Date: Thu, 14 May 2026 00:01:26 +0200 Message-ID: <20260513220336.369628-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260513220336.369628-1-andriy.shevchenko@linux.intel.com> References: <20260513220336.369628-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Every platform driver can be forced to match a device that doesn't match its list of device IDs because of device_match_driver_override() so platform drivers that rely on the existence of a device's driver data need to verify its presence. Accordingly, add requisite match and driver data checks against NULL to the driver where they are missing. Fixes: a4a86d273ff1 ("phy: phy-can-transceiver: Add support for generic CAN= transceiver driver") Signed-off-by: Andy Shevchenko --- drivers/phy/phy-can-transceiver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transc= eiver.c index 2b52e47f247a..1808f903c057 100644 --- a/drivers/phy/phy-can-transceiver.c +++ b/drivers/phy/phy-can-transceiver.c @@ -162,6 +162,9 @@ static int can_transceiver_phy_probe(struct platform_de= vice *pdev) int err, i, num_ch =3D 1; =20 match =3D of_match_node(can_transceiver_phy_ids, pdev->dev.of_node); + if (!match || !match->data) + return -ENODEV; + drvdata =3D match->data; if (drvdata->flags & CAN_TRANSCEIVER_DUAL_CH) num_ch =3D 2; --=20 2.50.1 From nobody Thu Jun 11 18:58:26 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7052F3CAA3B; Wed, 13 May 2026 22:03:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778709826; cv=none; b=SIlwg35n2yPfXYL3dQTNyiVQ9fXtVAF5YytlSHMjzoqMu3bwhlnu5kbkHBxMcuLbD5i2VbtgNAiTvoU+SpeuHtlIoU7lLxWPet0GqbZsoFsoF3LVgEbaCbtP/Tbr4drODJJP9uBbXMLAQ2hw6C4qScoOPcWrDdBbQoKB4zk64qM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778709826; c=relaxed/simple; bh=Puy6ngsQY/0YjfmDOaDKNp63+djPMuQx42KTX9C5XYQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MLwZ5uV8GITce17IvYHmAjbF1s3ENGCZWkV7NyFNequeP7rWPHr85cHI/Bmy/WRrHvAj1UXKKy22n1aBeQBtaxrBeOrUm8aTPuODz0/O4620BqkN9hqv3feNDZ7lE5Y/4V5+3omjkOlQ6CUu4dC8lXvRGNuYmnSTv+unmqH84Zg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=IZ8CUHHy; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IZ8CUHHy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778709825; x=1810245825; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Puy6ngsQY/0YjfmDOaDKNp63+djPMuQx42KTX9C5XYQ=; b=IZ8CUHHyhF7+t0of/sJjhHNQBXDdsg6K3IsNSAVvb7tzODdr6UV6sqz4 FqXXj9eEpGV57MZo31gNOzDNl11+RJcQ2+IEYntz+DR4MUFfGkd0J77/v eY2FDJlcbG38AOKvPanpxDC6jhZSfRrucdS7IwzYpVvqRClbwFtB4LQ2/ DPt6wJkt106PmJo2bbjzhCxhnqwJOkH4KDd7L3AgBqoXg0mQIcStKvgrf WLkarq24rT8pkz2dT+rzaZXYTHB6T8t/TptIe+Oap8WFC1+hiDRtpI14l 0suDN4YkzZNCVw18w2/hJbr/CTgIb5JgrmNn7AwpyV+QBLspOTppJ0AjL g==; X-CSE-ConnectionGUID: wNJk7GFrTnKr9zlLBqZXAA== X-CSE-MsgGUID: ywsNs1ibQOa4+JCKOaQ/vg== X-IronPort-AV: E=McAfee;i="6800,10657,11785"; a="79600728" X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="79600728" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2026 15:03:42 -0700 X-CSE-ConnectionGUID: JdczoZvNT8m5WKbYV/pxhA== X-CSE-MsgGUID: 1HVDaJswTnqYRRsiQsh7sg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="238447028" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa007.jf.intel.com with ESMTP; 13 May 2026 15:03:39 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 9834299; Thu, 14 May 2026 00:03:38 +0200 (CEST) From: Andy Shevchenko To: Peng Fan , linux-can@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marc Kleine-Budde , Vincent Mailhol , Vinod Koul , Neil Armstrong , Josua Mayer , Ulf Hansson , Andy Shevchenko Subject: [PATCH v5 2/6] phy: phy-can-transceiver: use device_get_match_data() Date: Thu, 14 May 2026 00:01:27 +0200 Message-ID: <20260513220336.369628-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260513220336.369628-1-andriy.shevchenko@linux.intel.com> References: <20260513220336.369628-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the generic firmware node interface for retrieving device match data instead of the OF-specific one. While at it, drop unneeded argument to devm_phy_create() which extracts device node from the given device by default. Reviewed-by: Josua Mayer Signed-off-by: Andy Shevchenko --- drivers/phy/phy-can-transceiver.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transc= eiver.c index 1808f903c057..37b706d841ff 100644 --- a/drivers/phy/phy-can-transceiver.c +++ b/drivers/phy/phy-can-transceiver.c @@ -5,9 +5,9 @@ * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com * */ -#include #include #include +#include #include #include #include @@ -152,7 +152,6 @@ static int can_transceiver_phy_probe(struct platform_de= vice *pdev) struct can_transceiver_phy *can_transceiver_phy; struct can_transceiver_priv *priv; const struct can_transceiver_data *drvdata; - const struct of_device_id *match; struct phy *phy; struct gpio_desc *silent_gpio; struct gpio_desc *standby_gpio; @@ -161,11 +160,10 @@ static int can_transceiver_phy_probe(struct platform_= device *pdev) u32 max_bitrate =3D 0; int err, i, num_ch =3D 1; =20 - match =3D of_match_node(can_transceiver_phy_ids, pdev->dev.of_node); - if (!match || !match->data) + drvdata =3D device_get_match_data(dev); + if (!drvdata) return -ENODEV; =20 - drvdata =3D match->data; if (drvdata->flags & CAN_TRANSCEIVER_DUAL_CH) num_ch =3D 2; =20 @@ -190,7 +188,7 @@ static int can_transceiver_phy_probe(struct platform_de= vice *pdev) can_transceiver_phy =3D &priv->can_transceiver_phy[i]; can_transceiver_phy->priv =3D priv; =20 - phy =3D devm_phy_create(dev, dev->of_node, &can_transceiver_phy_ops); + phy =3D devm_phy_create(dev, NULL, &can_transceiver_phy_ops); if (IS_ERR(phy)) { dev_err(dev, "failed to create can transceiver phy\n"); return PTR_ERR(phy); --=20 2.50.1 From nobody Thu Jun 11 18:58:26 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90DA33CA4B2; Wed, 13 May 2026 22:03:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778709825; cv=none; b=nL+sjgmLOsqAjiArhfuW+gSvccQKfORO/mKp/ksRKULr2fyjOkYtSwdoI3jX3oOOHmjbI3oknDIDOql/SEDmrscDujN/1YDL8h3XKHBlIJv5pErusXwnNXppB3ObzOWQu8ob9GJxOZB059WzEmXniQGBDT7x27VfxSJXLQHZqI8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778709825; c=relaxed/simple; bh=Te4q2A4qL3QmWciWTToqRtfGDNdEIh4FL0tn9GrtLCY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mab66VVpC5L/v9OupRpaYKy+TI3u9iY6QO6kwpWCtEOk2t4Ad2ddUYgEQLJ1e6+21klQj/j1GPX+iQ0kvzM64uOgBIgHPV8oNphUxU5cnDlyFdy0xt5dTDh4V7PUWh/VKHsUbYuVh7SfMZouf3UMMMN8Gvnw6BJaqPq4uYf1rp8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AqY5CiWD; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AqY5CiWD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778709825; x=1810245825; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Te4q2A4qL3QmWciWTToqRtfGDNdEIh4FL0tn9GrtLCY=; b=AqY5CiWDnh5JPVA0qbfePOBl2kvIQDRRESpl31uC7K8cR+pOMRfPokhB bxMRpREL7MRofXdHafzblIZsDxISytUmDkd7E+ng5oy2tbWRzZKYbinjC TMpH8vSkGT59gz0KVubiQPyqZEbRE7waBjVLgJDVIeeqNlBD7+BOqkvOV 0KmPP5zkJmbkhygAZ8ChZDjJx+kZiRa4JZ0Q+O+d1WljHsHi36TjTz+y3 lAN42XENINQP8/78cKzJ/e+4Mv3beqQe55H4z3o3V1PbRT9gV4WwpuO/a Wzu07oX/tF5+T5wppgZTO16NUDjom8/baXtLUWMkIxt81dlGHYOaVnVJO Q==; X-CSE-ConnectionGUID: UP7euYhMT3GSOyUKmGl1kg== X-CSE-MsgGUID: MNZLKGoNRxaeEL77SLQXzg== X-IronPort-AV: E=McAfee;i="6800,10657,11785"; a="90749914" X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="90749914" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2026 15:03:43 -0700 X-CSE-ConnectionGUID: vCJ8FGsJSQ2F/cC3YTt4QQ== X-CSE-MsgGUID: odh5FsSKSlyTOSCOLjiWdA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="237224939" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa006.jf.intel.com with ESMTP; 13 May 2026 15:03:40 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 9C4989B; Thu, 14 May 2026 00:03:38 +0200 (CEST) From: Andy Shevchenko To: Peng Fan , linux-can@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marc Kleine-Budde , Vincent Mailhol , Vinod Koul , Neil Armstrong , Josua Mayer , Ulf Hansson , Andy Shevchenko Subject: [PATCH v5 3/6] phy: phy-can-transceiver: Move OF ID table closer to their user Date: Thu, 14 May 2026 00:01:28 +0200 Message-ID: <20260513220336.369628-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260513220336.369628-1-andriy.shevchenko@linux.intel.com> References: <20260513220336.369628-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is no code that uses ID table directly, except the struct device_driver at the end of the file. Hence, move table closer to its user. It's always possible to access them via a pointer. Signed-off-by: Andy Shevchenko --- drivers/phy/phy-can-transceiver.c | 58 +++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transc= eiver.c index 37b706d841ff..5c9698f77c7d 100644 --- a/drivers/phy/phy-can-transceiver.c +++ b/drivers/phy/phy-can-transceiver.c @@ -97,35 +97,6 @@ static const struct can_transceiver_data tja1057_drvdata= =3D { .flags =3D CAN_TRANSCEIVER_SILENT_PRESENT, }; =20 -static const struct of_device_id can_transceiver_phy_ids[] =3D { - { - .compatible =3D "ti,tcan1042", - .data =3D &tcan1042_drvdata - }, - { - .compatible =3D "ti,tcan1043", - .data =3D &tcan1043_drvdata - }, - { - .compatible =3D "nxp,tja1048", - .data =3D &tja1048_drvdata - }, - { - .compatible =3D "nxp,tja1051", - .data =3D &tja1051_drvdata - }, - { - .compatible =3D "nxp,tja1057", - .data =3D &tja1057_drvdata - }, - { - .compatible =3D "nxp,tjr1443", - .data =3D &tcan1043_drvdata - }, - { } -}; -MODULE_DEVICE_TABLE(of, can_transceiver_phy_ids); - static struct phy *can_transceiver_phy_xlate(struct device *dev, const struct of_phandle_args *args) { @@ -232,6 +203,35 @@ static int can_transceiver_phy_probe(struct platform_d= evice *pdev) return PTR_ERR_OR_ZERO(phy_provider); } =20 +static const struct of_device_id can_transceiver_phy_ids[] =3D { + { + .compatible =3D "ti,tcan1042", + .data =3D &tcan1042_drvdata + }, + { + .compatible =3D "ti,tcan1043", + .data =3D &tcan1043_drvdata + }, + { + .compatible =3D "nxp,tja1048", + .data =3D &tja1048_drvdata + }, + { + .compatible =3D "nxp,tja1051", + .data =3D &tja1051_drvdata + }, + { + .compatible =3D "nxp,tja1057", + .data =3D &tja1057_drvdata + }, + { + .compatible =3D "nxp,tjr1443", + .data =3D &tcan1043_drvdata + }, + { } +}; +MODULE_DEVICE_TABLE(of, can_transceiver_phy_ids); + static struct platform_driver can_transceiver_phy_driver =3D { .probe =3D can_transceiver_phy_probe, .driver =3D { --=20 2.50.1 From nobody Thu Jun 11 18:58:26 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B0B73C9EE8; Wed, 13 May 2026 22:03:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778709825; cv=none; b=QuRvRZo42W8LniJQG4C2jXeoKMxIf+W/okrFBOIvmn/dWy/z6pPSQmgoaCwVYWJmI5PVZSFuKgGmkXlfALwzOmjx3ZN6C6Q4lRMuDNH+kcFuI4aNK2LckRU2/hFzB0FbrGmAzHH/8LYhZyRjxpQ2vyk3XUfp87wxACztO0bPTx8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778709825; c=relaxed/simple; bh=s1l6DhuaA7WFVhf4UoEJrdxY4F6P6ok+s6nAgwQYEyM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YYm7wk2EZfq8EPuLJAo+90nN0B5pOLvcdGHdm6+BDL7Nce+gnl9TZ7KFh/jD9qRWKJfBQA1K7nxBG5SlAPO6fHkmu2Xyv9GN9YrKEZo2fFJaQs/JGYhdPTDg8myYCj1GLrMZo2CZCjZozP91zjthLd6/hMAOjVEVsqo0g+nePkc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YRbanQgn; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YRbanQgn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778709825; x=1810245825; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=s1l6DhuaA7WFVhf4UoEJrdxY4F6P6ok+s6nAgwQYEyM=; b=YRbanQgnYrBu1KWnWlYTTsT3xFy5xB0DC3vdXa3+rk2bfun+E17NSjI2 DTBS5WntDVicUQxPNghyvmZWTZX1mspeZQUXMoa/NcoINuHrY1GNkyOBK UNIMSFlKSX4YHRhivzVl4XEAV2RBQ+MonMV4PxtoAkIkxs26QWwDspSwz QzVVdZvtADfOrbhy4YsHufK3vXEjYXCAYw/s5BiSVgu41myXs+qhaLIRo U2iDBun+aPbTvJxM1BqjJ1MvIyGfUuSbz0HKg9eDe3Ix/28/OQvSz7qp4 8m1WZ3urGNShtxeSlRafE/VTRJv59JrBOdNjCgfw6Up7WlJMIv2JvCr6q A==; X-CSE-ConnectionGUID: VXZEgsxbRumQlD5vR/tpbw== X-CSE-MsgGUID: FopKuq2QQVeRyxb2a5klTQ== X-IronPort-AV: E=McAfee;i="6800,10657,11785"; a="90749922" X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="90749922" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2026 15:03:43 -0700 X-CSE-ConnectionGUID: fSwRn+XBRfa1aqTgtgCdUg== X-CSE-MsgGUID: mO5ryQoFST23JZGYRgMgzw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="237224938" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa006.jf.intel.com with ESMTP; 13 May 2026 15:03:40 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id A068F9D; Thu, 14 May 2026 00:03:38 +0200 (CEST) From: Andy Shevchenko To: Peng Fan , linux-can@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marc Kleine-Budde , Vincent Mailhol , Vinod Koul , Neil Armstrong , Josua Mayer , Ulf Hansson , Andy Shevchenko Subject: [PATCH v5 4/6] phy: phy-can-transceiver: Don't check for specific errors when parsing properties Date: Thu, 14 May 2026 00:01:29 +0200 Message-ID: <20260513220336.369628-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260513220336.369628-1-andriy.shevchenko@linux.intel.com> References: <20260513220336.369628-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of checking for the specific error codes (that can be considered a layering violation to some extent) check for the property existence first and then either parse it, or apply a default value. With that, return an error when parsing of the existing property fails. Signed-off-by: Andy Shevchenko --- drivers/phy/phy-can-transceiver.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transc= eiver.c index 5c9698f77c7d..3cebaa54f7db 100644 --- a/drivers/phy/phy-can-transceiver.c +++ b/drivers/phy/phy-can-transceiver.c @@ -128,8 +128,9 @@ static int can_transceiver_phy_probe(struct platform_de= vice *pdev) struct gpio_desc *standby_gpio; struct gpio_desc *enable_gpio; struct mux_state *mux_state; - u32 max_bitrate =3D 0; int err, i, num_ch =3D 1; + const char *propname; + u32 max_bitrate; =20 drvdata =3D device_get_match_data(dev); if (!drvdata) @@ -151,9 +152,17 @@ static int can_transceiver_phy_probe(struct platform_d= evice *pdev) =20 priv->mux_state =3D mux_state; =20 - err =3D device_property_read_u32(dev, "max-bitrate", &max_bitrate); - if ((err !=3D -EINVAL) && !max_bitrate) - dev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitra= te limit\n"); + propname =3D "max-bitrate"; + if (device_property_present(dev, propname)) { + err =3D device_property_read_u32(dev, propname, &max_bitrate); + if (err) + return dev_err_probe(dev, err, "failed to parse %s\n", propname); + + if (max_bitrate =3D=3D 0) + dev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitr= ate limit\n"); + } else { + max_bitrate =3D 0; + } =20 for (i =3D 0; i < num_ch; i++) { can_transceiver_phy =3D &priv->can_transceiver_phy[i]; --=20 2.50.1 From nobody Thu Jun 11 18:58:26 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEB3C3CBE6D; Wed, 13 May 2026 22:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778709829; cv=none; b=s3xM6v2bPX0EkyFT/I+lt97m78MuhCDB29eyTxI0QiDD0z6f3mQ7nxtEPa2HlQJiKKkDE2tWipMJTqrMPTYIRGBPWuupXJQGEe4zOj9r5Ld+reAkcnCwraud0mWuKhkJyKeDIiKCZptL8sj/3VPjWhr9sr2RNoB2aIJGGLRsQFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778709829; c=relaxed/simple; bh=DaSEWkcGChJRbPa/Kx7Iym2uzGhsNUktEg9iDbhkjbA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rtQWLRJv9sY7QLdOPOlkTl3BVsRQJhtiex2nymR9J3Yyi5gEzSXbsKO5JvaUPNtR29Bmnfhu2pe42P5Mg+RG8V/9fD75z+rD/g4dcWpvtgyUBcAtzSxEDZMSrbLUzDoW9NN7/HITXp1voK0zwsYI4yZeP4NFHQORn9OGVW++7po= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BsYfrTui; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BsYfrTui" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778709828; x=1810245828; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DaSEWkcGChJRbPa/Kx7Iym2uzGhsNUktEg9iDbhkjbA=; b=BsYfrTuidnvMJKCRFvqPAzoHhU2QdmocmDMSXOAL/ers0U8EfKZPZYNw GSblgtjwkoSidxsfYFRsVv0QxYWY7tE99sHXGIJLB0vA0Zc9uluuooqsL 2wrnGSro88Is4AS8Cfmj/abZGZ5U/yVemG0HthAIbdABdm4XdUpfszPes t5oixpJo+RVL3bVdyy/GU2mgKCtjKOkuh1K+YLxHwYiZZmbctgMrTQTYO BmphtTypmks9NxxBTfAY2AbVN2r/AtFeSJcz2+OWaJvxWFufWeFnpgdM8 SPllJ6INtoYGv2F9tW+EdwIwYJ93qXhBpApsq6tJmX/8EvLYqqnt2apv5 g==; X-CSE-ConnectionGUID: 2AwnK3w+QoSBjwVF1HQY+w== X-CSE-MsgGUID: ApFJlayTQ1+mPh+8WWWbOg== X-IronPort-AV: E=McAfee;i="6800,10657,11785"; a="90749942" X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="90749942" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2026 15:03:46 -0700 X-CSE-ConnectionGUID: tLdInD+aSRSBc/tIw5b1wA== X-CSE-MsgGUID: AcF7mBz3S9GpOE2PnWCriQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="237224944" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa006.jf.intel.com with ESMTP; 13 May 2026 15:03:43 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id A4B759E; Thu, 14 May 2026 00:03:38 +0200 (CEST) From: Andy Shevchenko To: Peng Fan , linux-can@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marc Kleine-Budde , Vincent Mailhol , Vinod Koul , Neil Armstrong , Josua Mayer , Ulf Hansson , Andy Shevchenko Subject: [PATCH v5 5/6] phy: phy-can-transceiver: Decouple assignment and definition in probe Date: Thu, 14 May 2026 00:01:30 +0200 Message-ID: <20260513220336.369628-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260513220336.369628-1-andriy.shevchenko@linux.intel.com> References: <20260513220336.369628-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The code like int foo =3D X; ... if (bar) foo =3D Y; is prone to subtle mistakes and hence harder to maintain as the foo value may be changed inadvertently while code in '...' grown in lines. On top it's harder to navigate to understand the possible values of foo when branch is not taken (requires to look somewhere else in the code, far from the pie= ce at hand). Besides that in case of taken branch the foo will be rewritten, which is not a problem per se, just an unneeded operation. Decouple assignment and definition to use if-else to address the inconvenie= nces described above. Signed-off-by: Andy Shevchenko --- drivers/phy/phy-can-transceiver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transc= eiver.c index 3cebaa54f7db..30330499585b 100644 --- a/drivers/phy/phy-can-transceiver.c +++ b/drivers/phy/phy-can-transceiver.c @@ -128,8 +128,8 @@ static int can_transceiver_phy_probe(struct platform_de= vice *pdev) struct gpio_desc *standby_gpio; struct gpio_desc *enable_gpio; struct mux_state *mux_state; - int err, i, num_ch =3D 1; const char *propname; + int err, i, num_ch; u32 max_bitrate; =20 drvdata =3D device_get_match_data(dev); @@ -138,6 +138,8 @@ static int can_transceiver_phy_probe(struct platform_de= vice *pdev) =20 if (drvdata->flags & CAN_TRANSCEIVER_DUAL_CH) num_ch =3D 2; + else + num_ch =3D 1; =20 priv =3D devm_kzalloc(dev, struct_size(priv, can_transceiver_phy, num_ch)= , GFP_KERNEL); if (!priv) --=20 2.50.1 From nobody Thu Jun 11 18:58:26 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C7BF3CAE84; Wed, 13 May 2026 22:03:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778709827; cv=none; b=s9qw9RvJC+W15sUtc3eSeztwtHkeXo359eJVfueTLjdIe2Xm7fY+vk73aIyp0GV8xjPsW8eEeTCtxIymRs7rapcnJIivVMsMyOHCTuQ5C9YO/udJ+jy4/x3el4qGk5mFT3HZvvojOrwr11ZcOrZtNSmWQVKtBpbf8gLllIR3W/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778709827; c=relaxed/simple; bh=gy1uI67ch6VNJy85J226jiXi1gtzpJYr85LZJvbDvLQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=to5mTVzJ5I5JwEq3QYmLk+X2Q7MmO0u3WB59TDftPLL9ipUEFy8ma3tWKEr3kz5WHLW/rUImqwfW0Bs+Y9G7RkBIoyeDt7J5Mw0tNgcoJwWCdGvSeKUohUQsmPBhBBXd2Zrt3cJKohw4+uQb7eFSv7Tcq9SHl1iehlIO3TDb91w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=lkFsOga3; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lkFsOga3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778709827; x=1810245827; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gy1uI67ch6VNJy85J226jiXi1gtzpJYr85LZJvbDvLQ=; b=lkFsOga3p4JJuM+MsV1CcxZLwRCcFOzbA7JmceSk+hgK1elRmIzxd6XP IZIdpW4MlI4/80ViQUxVmpS4Z8We2fQvm4Dg+LBIxuTHl05WepVAIYL5w Q1uEzIazVXgCihuizjETJqQtHXLDQ7kTyNmIzSg4teIfk8gxxkcHmlOdB PZiFUPxnqAY/zPvxK2D4slaINB/Sd9UT5qR4zBWXbdYbPkNqhI7Gi6Icw xhtcHYGrH7baZ5C286JjJ97+o1OBVWKijxYfqNwX29nfJkj8G5sXZ9vxB F7JP8NG+BKLymokDbUMsZjqPC3CzbLlhC1z9I2TSYlrdE/O3JZXZd9BrG w==; X-CSE-ConnectionGUID: yHKcZ99URHGUZq9u7OWpwA== X-CSE-MsgGUID: rZq413TsQG6SbsmZKfsC9Q== X-IronPort-AV: E=McAfee;i="6800,10657,11785"; a="90749933" X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="90749933" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2026 15:03:46 -0700 X-CSE-ConnectionGUID: 7kTdIxVUSbqu72h617A84Q== X-CSE-MsgGUID: fRbaHHhgRzmHjPYNUkV/Jg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,233,1770624000"; d="scan'208";a="237224945" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa006.jf.intel.com with ESMTP; 13 May 2026 15:03:43 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id A93ABA1; Thu, 14 May 2026 00:03:38 +0200 (CEST) From: Andy Shevchenko To: Peng Fan , linux-can@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marc Kleine-Budde , Vincent Mailhol , Vinod Koul , Neil Armstrong , Josua Mayer , Ulf Hansson , Andy Shevchenko Subject: [PATCH v5 6/6] phy: phy-can-transceiver: Drop unused include Date: Thu, 14 May 2026 00:01:31 +0200 Message-ID: <20260513220336.369628-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260513220336.369628-1-andriy.shevchenko@linux.intel.com> References: <20260513220336.369628-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This file does not use the symbols from the legacy header, so let's drop it. Reviewed-by: Josua Mayer Signed-off-by: Andy Shevchenko --- drivers/phy/phy-can-transceiver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transc= eiver.c index 30330499585b..75dc49e75ca0 100644 --- a/drivers/phy/phy-can-transceiver.c +++ b/drivers/phy/phy-can-transceiver.c @@ -5,12 +5,11 @@ * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com * */ +#include #include #include #include #include -#include -#include #include =20 struct can_transceiver_data { --=20 2.50.1