Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1021046pxb; Thu, 23 Sep 2021 16:13:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5CWR/WDj82Xfiu5blo/fhCatA7YOE7zNi5IcBCPpgLATc93YDxxDus6wonaJj3ORUjDKz X-Received: by 2002:a5d:9d59:: with SMTP id k25mr6012155iok.70.1632438782900; Thu, 23 Sep 2021 16:13:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632438782; cv=none; d=google.com; s=arc-20160816; b=XwQ9JwpLgcqzTGevDJlFxfBTAVfzuIrqUIzwEv29I8I5FLiXnYyf6A+IvtGtmIVBho 25/1W8dGLWqkPq8XnXrYUMylV8EoRH4oWYPUXUwTaYmRD6xHG3P8WKp02SKrnUJSaR/O d4GzHFiQZ/7VYYp2I/19gZynl9Z7p2HX/+amYK7bPGT3N8g+eqVo67ssaKhIMyARM7RA BbWMnr1ADFaLQGJaNvryCK6lndQgtmnvSTrFm3YTcL3Gpj8pZSx1uXoUnjb+xdv7d7MA IAZpATPC3s4dTI1jnYYefEpHFsGhhcxIUL8Qfu83k5doJZ6kvkjT4alUdaBt4LU2891w g9Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=w9X5QJVoOwbJ1sPqRFtDAIJLejaf31LSj6ln77xa3KQ=; b=X5M2LPinTRVuxqnqPXdbCwM0qBajjexe853bpiOPyDR79AEircpWyv92QUlOwt6wOP LEdWFwwl0i8KAvrems9m0BI/NplEWuniLzzCE6l857y1AxI+KDf9KRYvRchfmNbR5Qw6 fa0qlJwak3Gbnstu/XSxH/HewwJnaBAFUZPkV84tqM9c8h/LDtbkAS+qq1oPxw2atlQL SYQ8zwY2P8fcNU5f8gFcZ05vQaZRndrDEfgjOECijxS4eBAVUF8iHzbU6ya7yY9BsPvC Q2zSSXfZYeEkDJXZCG9KVAEneSNxfGDfoqCWVnQRHLygBlTsYqmvnGSGTaMbtUoAWudp MOxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d6xb0sBm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o12si8460768ilj.142.2021.09.23.16.12.50; Thu, 23 Sep 2021 16:13:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d6xb0sBm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243560AbhIWXM7 (ORCPT + 99 others); Thu, 23 Sep 2021 19:12:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:46392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243533AbhIWXM6 (ORCPT ); Thu, 23 Sep 2021 19:12:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BBA3D61107; Thu, 23 Sep 2021 23:11:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632438683; bh=ILJ6ftNnE9k3HLjd3767aM80d5dSXwBb9STyViQHsTU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=d6xb0sBmcLCsSN4o8Nmf9iBZmY6iH5GTHlUTZ4njs2oiGZTh3bnipzbuFqBILzhNF 5px5K9H0CcDO51xqA9JT5vbfYRvb9wt8A5YJkii6rglY3yLCjLi3U1TJCSOg6MH0ua eJZMmO7dG0QNdxwpNvFnPdz7dCOh1N4ATR7X0vZuwImk2U5Q4n4mPV9UU118v2M8t+ eTKCfSnGGoRgXKY1yZ9mLmZFBh6XZmK0VDZwqFmrBtco2c20AVkDiryk+MiBSjAc7B y2f/O2BPpkQuZ0h5UBgPN+RYTGDMXjGds1n4mYmeT1rGszU4aOEnTuVOV5KJjynLXJ zEIphBay1IBcg== Date: Fri, 24 Sep 2021 02:11:19 +0300 From: Leon Romanovsky To: Edwin Peer Cc: "David S . Miller" , Jakub Kicinski , Alexander Lobakin , Anirudh Venkataramanan , Ariel Elior , GR-everest-linux-l2@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, Igor Russkikh , intel-wired-lan@lists.osuosl.org, "James E.J. Bottomley" , Javed Hasan , Jeff Kirsher , Jesse Brandeburg , Jiri Pirko , Linux Kernel Mailing List , linux-scsi@vger.kernel.org, "Martin K. Petersen" , Michael Chan , Michal Kalderon , netdev , Sathya Perla , Saurav Kashyap , Tony Nguyen , Vasundhara Volam Subject: Re: [PATCH net-next 1/6] bnxt_en: Check devlink allocation and registration status Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 23, 2021 at 02:11:40PM -0700, Edwin Peer wrote: > On Thu, Sep 23, 2021 at 11:13 AM Leon Romanovsky wrote: > > > > From: Leon Romanovsky > > > > devlink is a software interface that doesn't depend on any hardware > > capabilities. The failure in SW means memory issues, wrong parameters, > > programmer error e.t.c. > > > > Like any other such interface in the kernel, the returned status of > > devlink APIs should be checked and propagated further and not ignored. > > > > Fixes: 4ab0c6a8ffd7 ("bnxt_en: add support to enable VF-representors") > > Signed-off-by: Leon Romanovsky > > --- > > drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 ++++- > > drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 13 ++++++------- > > drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h | 13 ------------- > > 3 files changed, 10 insertions(+), 21 deletions(-) <...> > > @@ -835,9 +837,6 @@ void bnxt_dl_unregister(struct bnxt *bp) > > { > > struct devlink *dl = bp->dl; > > > > - if (!dl) > > - return; > > - > > minor nit: There's obviously nothing incorrect about doing this (and > adding the additional error label in the cleanup code above), but bnxt > has generally adopted a style of having cleanup functions being > idempotent. It generally makes error handling simpler and less error > prone. I would argue that opposite is true. Such "impossible" checks hide unwind flow errors, missing releases e.t.c. <...> > > > > Reviewed-by: Edwin Peer Thanks for the review. > > Regards, > Edwin Peer