From mboxrd@z Thu Jan 1 00:00:00 1970 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 214AAC433EF for ; Sun, 2 Jan 2022 16:44:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230519AbiABQnl (ORCPT ); Sun, 2 Jan 2022 11:43:41 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:47316 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229738AbiABQnk (ORCPT ); Sun, 2 Jan 2022 11:43:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=p6z6R4Zq+iBUkifmKKYAC9qMQJ+15+ZEEM8C6DzOWp8=; b=j7 Yd+uaaPiOFOfX2kH4cp/I+XeYgzct+wydzajip0fLO0Yk37F78L5G6gguHWqTriOxFYKkv33fa0K0 12j066oLGvT7SlKZzZGl3LX5L0dA37ypyJYGDWEo6e06fGXdaNIV/CwLQQEc7fg5zzOc2vnaPjBKs OYbs7McL3NMmMy8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1n43xE-000JsH-6L; Sun, 02 Jan 2022 17:43:32 +0100 Date: Sun, 2 Jan 2022 17:43:32 +0100 From: Andrew Lunn To: Daniel Golle Cc: linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Felix Fietkau , John Crispin , Sean Wang , Mark Lee , "David S. Miller" , Jakub Kicinski , Matthias Brugger , Russell King , Michael Lee , Heiner Kallweit Subject: Re: [PATCH v10 1/3] net: ethernet: mtk_eth_soc: fix return value and refactor MDIO ops Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org =17> +static int _mtk_mdio_write(struct mtk_eth *eth, u32 phy_addr, u32 phy= _reg, > + u32 write_data) > { > if (mtk_mdio_busy_wait(eth)) > - return -1; > - > - write_data &=3D 0xffff; > + return -EBUSY; -ETIMEDOUT would be more normal. I would probably also change mtk_mdio_busy_wait() so that it either returned 0, or -ETIMEDOUT. That is the general pattern in Linux, return 0 on success, or a negative error code. Returning -1 is an invitation for trouble. The code would then become ret =3D mtk_mdio_busy_wait(eth); if (ret < 0) return ret; which is a very common pattern in Linux. Andrew