Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp4051025rdg; Wed, 18 Oct 2023 13:29:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfhdWhMpvPhzhaD53aMxkHRbF0gSf9d6wVCVl/0WZtzfl5kX4MVnh1CnTzVk05TvsMyxDC X-Received: by 2002:a05:6a20:144b:b0:16b:c20d:f979 with SMTP id a11-20020a056a20144b00b0016bc20df979mr249886pzi.13.1697660980769; Wed, 18 Oct 2023 13:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697660980; cv=none; d=google.com; s=arc-20160816; b=seESLulJ0b9sCmFQyj6gYGEIJ4uUzKzJzqKyOvEw+PwLCGfpBlOLSti/Gy+MBSKXhR +Lc9uyIZ0w0GGDiXW76YoZCstAphOUlunuo2/ub84wDrHa9NIeqzy/YYq66azv48GyJK 1F7PCs/HdZZHlUVfrLi/teiyCwcdXl8iCid4X7QVx8t4F9QPToD9ivwTPJiZKdAm7tDs e5Gc7PhjcHR18R6X89WqDXsHLnSFjKZJuLJ4Tm9VoL9JHeaLhN4vXrb9BJg9GIuGeh1D zhHLy1yqJNKSdtb3tQBTUS6YVJA5YEiyKwDxuL2wCDwrU6NsCFDSsbeGFI+wpKedTDqQ bpNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sP26tI+1ZJaQMMJwxh27C2bS3O9Wf7FqV3abtpx452Q=; fh=73Q7A8iXNRaSNjFjRBFCA7iJqXMhbXTEBWwh83Jj+fc=; b=ZjrD9GazjAZqtZdXyC1e5MLMBy7lcjP0hAfhV9iHXajbZfFgKTtfz+TuUwifwgrT8D /b5knNiloWadbA+x2aCzrEMi9RIJN3CJR+YvIPvIe7A+TUMsyGKjgBF4HUbEP7jEyRUJ X6g/38v7MW+kXNFqDwrHssS8xW4MR9z0/+TWh5IPIUMuHxP/vkcKlWG2cWAyecaf1119 GNVDp7v1hFZi50K+YJf/vArxZF4FH2wfz/bFQj7xaZkzCq2LrI8D6M6dY1FZpmPUb8WA FZ13muAhMmThhEDaoPkQkk9Ms0VEOB6f/VTLrUUruCs+bFYxhVgBFGxH42QgoZ9k6c9T s8MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=alXd+jUV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id x190-20020a6386c7000000b00585a02550e1si3080957pgd.50.2023.10.18.13.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 13:29:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=alXd+jUV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id DC7328145555; Wed, 18 Oct 2023 13:29:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231911AbjJRU3K (ORCPT + 99 others); Wed, 18 Oct 2023 16:29:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344608AbjJRU2y (ORCPT ); Wed, 18 Oct 2023 16:28:54 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 047AA181; Wed, 18 Oct 2023 13:28:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697660913; x=1729196913; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=41Cw0M5oWSuOe/byt5eX4fcv0uhH1yjV2sbnWcgT1iQ=; b=alXd+jUVz8lbLSi62cNi/x8Pb+wcWXmd0bTmB0UPPljTOUGbZlVeDkLs qfVvrY4AwdnFqzsFhrjhPd9IzFZantBM1p2FQK2RAnOJEd+ggL9NWIj2l jWszCyeBmxEFcccS0YKeKclzA0u7kNKX7a1C/udFQRJUy+553uBlwaBdP Adx01rmzwEv4q8v46Bb1kVUbHbw9q9BNnFZzdVQAoA6WdB30vUTm8BCRY FhllaYakrJEZcSISUwYf1JpzanaArkpbKTbnOpX8sHwUmomeVwv3k0ecB L7fLm3yVlpd6s1W1mLpbXTghszTW1wq+87KxA2JzV1q1Tc7JIjegXABuN g==; X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="371168140" X-IronPort-AV: E=Sophos;i="6.03,235,1694761200"; d="scan'208";a="371168140" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 13:28:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="756722410" X-IronPort-AV: E=Sophos;i="6.03,235,1694761200"; d="scan'208";a="756722410" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orsmga002.jf.intel.com with ESMTP; 18 Oct 2023 13:28:23 -0700 Received: from pkitszel-desk.intel.com (unknown [10.255.194.180]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 8C3B033E8B; Wed, 18 Oct 2023 21:28:15 +0100 (IST) From: Przemek Kitszel To: Jiri Pirko , netdev@vger.kernel.org, "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shannon Nelson , Michael Chan , Cai Huoqing , George Cherian , Danielle Ratson , Moshe Shemesh , Saeed Mahameed , Ariel Elior , Manish Chopra , Igor Russkikh , Coiby Xu , Simon Horman Cc: Brett Creeley , Sunil Goutham , Linu Cherian , Geetha sowjanya , Jerin Jacob , hariprasad , Subbaraya Sundeep , Ido Schimmel , Petr Machata , Eran Ben Elisha , Aya Levin , Leon Romanovsky , linux-kernel@vger.kernel.org, Benjamin Poirier , Przemek Kitszel , Jiri Pirko Subject: [PATCH net-next v3 10/11] staging: qlge: devlink health: use retained error fmsg API Date: Wed, 18 Oct 2023 22:26:46 +0200 Message-Id: <20231018202647.44769-11-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231018202647.44769-1-przemyslaw.kitszel@intel.com> References: <20231018202647.44769-1-przemyslaw.kitszel@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 18 Oct 2023 13:29:29 -0700 (PDT) Drop unneeded error checking. devlink_fmsg_*() family of functions is now retaining errors, so there is no need to check for them after each call. Reviewed-by: Jiri Pirko Signed-off-by: Przemek Kitszel --- drivers/staging/qlge/qlge_devlink.c | 60 ++++++++--------------------- 1 file changed, 16 insertions(+), 44 deletions(-) diff --git a/drivers/staging/qlge/qlge_devlink.c b/drivers/staging/qlge/qlge_devlink.c index 0ab02d6d3817..0b19363ca2e9 100644 --- a/drivers/staging/qlge/qlge_devlink.c +++ b/drivers/staging/qlge/qlge_devlink.c @@ -2,51 +2,29 @@ #include "qlge.h" #include "qlge_devlink.h" -static int qlge_fill_seg_(struct devlink_fmsg *fmsg, - struct mpi_coredump_segment_header *seg_header, - u32 *reg_data) +static void qlge_fill_seg_(struct devlink_fmsg *fmsg, + struct mpi_coredump_segment_header *seg_header, + u32 *reg_data) { int regs_num = (seg_header->seg_size - sizeof(struct mpi_coredump_segment_header)) / sizeof(u32); - int err; int i; - err = devlink_fmsg_pair_nest_start(fmsg, seg_header->description); - if (err) - return err; - err = devlink_fmsg_obj_nest_start(fmsg); - if (err) - return err; - err = devlink_fmsg_u32_pair_put(fmsg, "segment", seg_header->seg_num); - if (err) - return err; - err = devlink_fmsg_arr_pair_nest_start(fmsg, "values"); - if (err) - return err; + devlink_fmsg_pair_nest_start(fmsg, seg_header->description); + devlink_fmsg_obj_nest_start(fmsg); + devlink_fmsg_u32_pair_put(fmsg, "segment", seg_header->seg_num); + devlink_fmsg_arr_pair_nest_start(fmsg, "values"); for (i = 0; i < regs_num; i++) { - err = devlink_fmsg_u32_put(fmsg, *reg_data); - if (err) - return err; + devlink_fmsg_u32_put(fmsg, *reg_data); reg_data++; } - err = devlink_fmsg_obj_nest_end(fmsg); - if (err) - return err; - err = devlink_fmsg_arr_pair_nest_end(fmsg); - if (err) - return err; - err = devlink_fmsg_pair_nest_end(fmsg); - return err; + devlink_fmsg_obj_nest_end(fmsg); + devlink_fmsg_arr_pair_nest_end(fmsg); + devlink_fmsg_pair_nest_end(fmsg); } -#define FILL_SEG(seg_hdr, seg_regs) \ - do { \ - err = qlge_fill_seg_(fmsg, &dump->seg_hdr, dump->seg_regs); \ - if (err) { \ - kvfree(dump); \ - return err; \ - } \ - } while (0) +#define FILL_SEG(seg_hdr, seg_regs) \ + qlge_fill_seg_(fmsg, &dump->seg_hdr, dump->seg_regs) static int qlge_reporter_coredump(struct devlink_health_reporter *reporter, struct devlink_fmsg *fmsg, void *priv_ctx, @@ -114,14 +92,8 @@ static int qlge_reporter_coredump(struct devlink_health_reporter *reporter, FILL_SEG(xfi_hss_tx_hdr, serdes_xfi_hss_tx); FILL_SEG(xfi_hss_rx_hdr, serdes_xfi_hss_rx); FILL_SEG(xfi_hss_pll_hdr, serdes_xfi_hss_pll); - - err = qlge_fill_seg_(fmsg, &dump->misc_nic_seg_hdr, - (u32 *)&dump->misc_nic_info); - if (err) { - kvfree(dump); - return err; - } - + qlge_fill_seg_(fmsg, &dump->misc_nic_seg_hdr, + (u32 *)&dump->misc_nic_info); FILL_SEG(intr_states_seg_hdr, intr_states); FILL_SEG(cam_entries_seg_hdr, cam_entries); FILL_SEG(nic_routing_words_seg_hdr, nic_routing_words); @@ -140,7 +112,7 @@ static int qlge_reporter_coredump(struct devlink_health_reporter *reporter, FILL_SEG(sem_regs_seg_hdr, sem_regs); kvfree(dump); - return err; + return 0; } static const struct devlink_health_reporter_ops qlge_reporter_ops = { -- 2.38.1