From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="l3y/Gfkx"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="DieFae+I" Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AADE09D; Mon, 20 Nov 2023 23:12:18 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id EC98C5C0C58; Tue, 21 Nov 2023 02:12:17 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 21 Nov 2023 02:12:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1700550737; x=1700637137; bh=04 AJGy4oa9MjsWPrnDD6xwdZTHm1YQvdW/pByyPc3e4=; b=l3y/GfkxohGfFNzHRn q6FVzZTcaDrXmOpvsaQHmG88ZqMXyAvxlK5ST3wLqsTS4nuaPcboBQCDMU5F88N9 Rwo9MkPLprXRBCa0J9wNzSoH3Mz4r94RGGnIxY7fwdNHnA9V05TLW8YetDSc/8gF zFxMZNBdkDBDrtA4Mcmy4llX4R3uI7Lc5btmrwlwhekq9uS/X225pw34oNF0MLS4 rvtgfVzfla49q6LF8nVYNgW+z/zc5DbNEBn+OAwooArtY1QKF0NcvHMcXF+btJTS wFkyJ6nXIzyJzbX16MUFEFwpqaYa3a7EWVqCdJavQYhhLi7BTQHj2LlBwSzGqjEV p6/g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1700550737; x=1700637137; bh=04AJGy4oa9Mjs WPrnDD6xwdZTHm1YQvdW/pByyPc3e4=; b=DieFae+IkvBry6ckdYrqzlm5f2EvV Gz4k1d/Nkf9QG+RK7385W/wqPjrEBmFDS7OvD1Y9kMtnlMThpZ8P7ETyUKi1fns/ eelqEuahniXG1+M/Huws2Du8YG1IIrD0g0JdwhC1J0Ku8CHbUZiKZSIzFbifEfbZ KpXRRUJB7fhw+pknysF0mPVS5mgXGUXdQN/6DxkCvQlmfzlpswfX4NPz9I4c++Ij T0y7M3LfXFMFcET/dZz/VTUCEl5b53VyoJPhzmo4LhWCMmomkpp+9JX0qhG2wNh6 D/3g9i7a4jucIVa6wYEAlMIAngRjInvFCjw8dxfOFSDeWU57EQkzvStug== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudegkedguddtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefirhgv ghcumffjuceoghhrvghgsehkrhhorghhrdgtohhmqeenucggtffrrghtthgvrhhnpeehge dvvedvleejuefgtdduudfhkeeltdeihfevjeekjeeuhfdtueefhffgheekteenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhroh grhhdrtghomh X-ME-Proxy: Feedback-ID: i787e41f1:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 Nov 2023 02:12:16 -0500 (EST) Date: Tue, 21 Nov 2023 08:12:09 +0100 From: Greg KH To: FUJITA Tomonori Cc: andrew@lunn.ch, aliceryhl@google.com, benno.lossin@proton.me, miguel.ojeda.sandonis@gmail.com, netdev@vger.kernel.org, rust-for-linux@vger.kernel.org, tmgross@umich.edu, wedsonaf@gmail.com Subject: Re: [PATCH net-next v7 5/5] net: phy: add Rust Asix PHY driver Message-ID: <2023112136-paver-agreed-0bc1@gregkh> References: <20231117093915.2515418-1-aliceryhl@google.com> <20231119.185736.1872000177070369059.fujita.tomonori@gmail.com> <363b810d-7d6c-48bd-879b-f97acffa70b6@lunn.ch> <20231121.151939.1903605088782465261.fujita.tomonori@gmail.com> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231121.151939.1903605088782465261.fujita.tomonori@gmail.com> On Tue, Nov 21, 2023 at 03:19:39PM +0900, FUJITA Tomonori wrote: > On Sun, 19 Nov 2023 17:03:30 +0100 > Andrew Lunn wrote: > > >> >> + let _ = dev.init_hw(); > >> >> + let _ = dev.start_aneg(); > >> > > >> > Just to confirm: You want to call `start_aneg` even if `init_hw` returns > >> > failure? And you want to ignore both errors? > >> > >> Yeah, I tried to implement the exact same behavior in the original C driver. > > > > You probably could check the return values, and it would not make a > > difference. Also, link_change_notify() is a void function, so you > > cannot return the error anyway. > > > > These low level functions basically only fail if the hardware is > > `dead`. You get an -EIO or maybe -TIMEDOUT back. And there is no real > > recovery. You tend to get such errors during probe and fail the > > probe. Or maybe if power management is wrong and it has turned a > > critical clock off. But that is unlikely in this case, we are calling > > link_change_notify because the PHY has told us something changed > > recently, so it probably is alive. > > > > I would say part of not checking the return code is also that C does > > not have the nice feature that Rust has of making very simple to check > > the return code. That combined with it being mostly pointless for PHY > > drivers. > > Understood. I'll check the first return value if you prefer. I might > add WARN_ON_ONCE after Rust supports it. Please don't, it shouldn't support it, handle errors properly and return, don't panic machines (remember, the majority of the Linux systems in the world run panic-on-warn). thanks, g reg k-h