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 X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55878C43461 for ; Thu, 17 Sep 2020 07:34:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F02482072E for ; Thu, 17 Sep 2020 07:34:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RvLh7KeJ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="OOGU1T9k" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F02482072E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Date:To:From: Subject:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aFZz9H+FQb/U1a7iIGymAo7KzKaI2s+n3aWOLGr+CcY=; b=RvLh7KeJUuKNZ6QE/+vq/K7vR w5/A8DcDA8ubsCQ1BPmLL5rawZA4kCNfqEUKG4UEnF6JsRBZb4NHv8VmHLsf8H96Mg8wk/gAGtOnx EDseKx+615rhU6dr+HIDb70QsDAukhpMlXTabYKPTWf3DyvzG+WVLYtPkaHpMBHrcW3MLZKMu946H xaYL97NwSt0I2LwzYitnWPW5sNTlw3dgw8PZI0ymDkB5i+J3L4W7X4o00yjkAbKdMMhct/NymeUr8 3sIOEz68D7HWz8uNPZILOYeptK8ukVsOIWQAqZVAEX+knxO2ENJFJBXB6NuJXVb9WwZX959JUrdNR Bhp81BR+A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIoPn-0005nb-HN; Thu, 17 Sep 2020 07:33:11 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIoPk-0005ma-Uh; Thu, 17 Sep 2020 07:33:10 +0000 X-UUID: d124505e645c4d2f8305fbf92be535c1-20200916 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=cSlCNcl11u7qHTtN7BxhpCgzqViFmJKikDj8COuqZE8=; b=OOGU1T9kbZHyfUTyYSEZ4xcpLiixKJpx9xdV16W1ThP3YNzvqyAdScINoP2cRaA3tasXqbxUK/92B+RC6PDnijMnrH/w1vWlKY9i12d1eCW3bDTP2inY/+9SJEs4iM2eUuU8iy1iYPpYHIBYP7NWG6NbyOtuPcqQ/uK7AoJrLGU=; X-UUID: d124505e645c4d2f8305fbf92be535c1-20200916 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1316167356; Wed, 16 Sep 2020 23:33:01 -0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 17 Sep 2020 00:32:58 -0700 Received: from [172.21.84.99] (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 17 Sep 2020 15:32:58 +0800 Message-ID: <1600327978.11746.22.camel@mtksdccf07> Subject: Re: [PATCH] net: dsa: mt7530: Add some return-value checks From: Landen Chao To: Alex Dewar Date: Thu, 17 Sep 2020 15:32:58 +0800 In-Reply-To: <20200916195017.34057-1-alex.dewar90@gmail.com> References: <20200916195017.34057-1-alex.dewar90@gmail.com> X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200917_033309_256209_9106FD58 X-CRM114-Status: GOOD ( 19.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Florian Fainelli , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , Sean Wang , Russell King , "David S. Miller" , "linux-mediatek@lists.infradead.org" , Matthias Brugger , Jakub Kicinski , Vivien Didelot , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Alex, Thanks for your review and fixing. On Thu, 2020-09-17 at 03:50 +0800, Alex Dewar wrote: [..] > > If it is not expected that these functions will throw errors (i.e. > because the parameters passed will always be correct), we could dispense > with the use of EINVAL errors and just use BUG*() macros instead. Let me > know if you'd rather I fix things up in that way. The cpu port setting is passed by dts. Use EINVAL to catch unexpected setting is fine. > > Best, > Alex > > drivers/net/dsa/mt7530.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > index 61388945d316..157d0a01faae 100644 > --- a/drivers/net/dsa/mt7530.c > +++ b/drivers/net/dsa/mt7530.c > @@ -945,10 +945,14 @@ static int > mt753x_cpu_port_enable(struct dsa_switch *ds, int port) > { > struct mt7530_priv *priv = ds->priv; > + int ret; > > /* Setup max capability of CPU port at first */ > - if (priv->info->cpu_port_config) > - priv->info->cpu_port_config(ds, port); > + if (priv->info->cpu_port_config) { > + ret = priv->info->cpu_port_config(ds, port); > + if (ret) > + return ret; > + } How about check return value in caller function, mt7530_setup() and mt7531_setup(), too? if (dsa_is_cpu_port(ds, i)) { ret = mt753x_cpu_port_enable(ds, i); if (ret) return ret; } else { [..] regards, landen _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel