From mboxrd@z Thu Jan 1 00:00:00 1970 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 CFE10318BB3; Thu, 19 Feb 2026 20:29:16 +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=1771532958; cv=none; b=R88kzyeRJ/+aWHe+U7BN4MmnHydEqfNk+1aiYbYlLw3BA9mfi6CNr1gjjXeuhONiWLjTM/QCd+F3QMH+c9lwq8tMYl4fPiPu64CcCcnx+akdF+bc0avq9pSTDXiAYZV3KopEXlXZ/dlN71LMVnpQD34D/f+OFeRsUVPixEAK5gk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771532958; c=relaxed/simple; bh=UVb/lJOOJhogtTXNOnHshhDE7UWpEz6L/FN2AVGtFbY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CmeFtaAN58GWEJfdEMSNQJU5xiLXMgS0Q89y6g5INOw4SgmnTkO8kP9sID7jCYnjdDkKTTYh7PL6hReOf0aqPdZRREcw94TtSxM9bdPjiKTD5ZfPhmx9XWhcHy9n6NQYXqEBDWdKmXzIGoxVx1vFI8/ZDMGGdEDfoCWdfPQwq2Y= 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=m2ZwsOgr; 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="m2ZwsOgr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1771532956; x=1803068956; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UVb/lJOOJhogtTXNOnHshhDE7UWpEz6L/FN2AVGtFbY=; b=m2ZwsOgrJjFafTPbXZyI0QRqZGjYe5QiOPVDGgZaK7cXmlcJ9DIv3Skr ZwHKSqTYcA4dynqtCIa/R6zMhg4tDyact1yP/FbFEycygLlH7BCKRRn53 JMbhKpwvtLcL/2QfbgQgaGlWOhYSPK/2BRNhJKPwkpNcSgB1feuPvTdt4 hZ6kztwwrXVhn9zMwPudvBDNYJ/EWbcsqWY4Oj1RoJ75uMFJZ4CxdDNAM tCm0XV1K7d4kJ+2kRpY2KnKQo/436LzYdfawuU2hevUQ5S5CIPjz03BA0 JoJYNpavQC1QrBKB1nRuQ0fhv4R54pYiPFhh2U2k+HwL+a1x/k0PvS8WV A==; X-CSE-ConnectionGUID: t2tI9dcTSHa6tVIX/XHKyw== X-CSE-MsgGUID: Lh7iJsupRbK0bUp1LSDuuw== X-IronPort-AV: E=McAfee;i="6800,10657,11706"; a="72532337" X-IronPort-AV: E=Sophos;i="6.21,300,1763452800"; d="scan'208";a="72532337" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2026 12:29:15 -0800 X-CSE-ConnectionGUID: vaxD0SWIR6uxqp1QKPDpbQ== X-CSE-MsgGUID: RT6iERWuQCahA0gz9TWgCw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,300,1763452800"; d="scan'208";a="219183208" Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa005.fm.intel.com with ESMTP; 19 Feb 2026 12:29:13 -0800 Received: by black.igk.intel.com (Postfix, from userid 1003) id 076F89B; Thu, 19 Feb 2026 21:29:12 +0100 (CET) From: Andy Shevchenko To: 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 , Andy Shevchenko Subject: [PATCH v1 3/4] phy: phy-can-transceiver: Don't check for specific errors when parsing properties Date: Thu, 19 Feb 2026 21:26:21 +0100 Message-ID: <20260219202910.2304440-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260219202910.2304440-1-andriy.shevchenko@linux.intel.com> References: <20260219202910.2304440-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-can@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transceiver.c index dd08faf46837..ebce48ef217f 100644 --- a/drivers/phy/phy-can-transceiver.c +++ b/drivers/phy/phy-can-transceiver.c @@ -138,8 +138,9 @@ static int can_transceiver_phy_probe(struct platform_device *pdev) struct gpio_desc *standby_gpio; struct gpio_desc *enable_gpio; struct mux_state *mux_state; - u32 max_bitrate = 0; int err, i, num_ch = 1; + const char *propname; + u32 max_bitrate; drvdata = device_get_match_data(dev); if (drvdata->flags & CAN_TRANSCEIVER_DUAL_CH) @@ -158,8 +159,15 @@ static int can_transceiver_phy_probe(struct platform_device *pdev) priv->mux_state = mux_state; - err = device_property_read_u32(dev, "max-bitrate", &max_bitrate); - if ((err != -EINVAL) && !max_bitrate) + propname = "max-bitrate"; + if (device_property_present(dev, propname)) { + err = device_property_read_u32(dev, "max-bitrate", &max_bitrate); + if (err) + return dev_err_probe(dev, err, "failed to parse %s\n", propname); + } else { + max_bitrate = 0; + } + if (!max_bitrate) dev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit\n"); for (i = 0; i < num_ch; i++) { -- 2.50.1