Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp257778rwl; Sat, 25 Mar 2023 01:36:35 -0700 (PDT) X-Google-Smtp-Source: AKy350allwgSUAWlhylqHElZTBx6YAP902Zt7CnxhnE+YD0BqSTSqlb4o6Dj2mZf4EOxmjr5iIkT X-Received: by 2002:a17:906:7cc8:b0:932:8dc:5afe with SMTP id h8-20020a1709067cc800b0093208dc5afemr5004480ejp.67.1679733395449; Sat, 25 Mar 2023 01:36:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679733395; cv=pass; d=google.com; s=arc-20160816; b=DwLJ3BN//+jxFtBRJUVt6pDhiI95UCdqCZUJIGjdnbFy27+HsoLjbyK9f7booop9SL J3HgINoWV0bhHsJbhtvHdxoGme8ATelUzNfuG+iirGCqjA/ejir0+RWduFoJPlPSUHZh 2quS2sxld+ZQFd1141hYnTgDd5gocr8HwpYCqp0/Pu1lc1W5ShnDuWcr9q2LMe0vq75y YihZ6zC5HmRZRFR9FRn+VhYyNy/N5TZ8mVu8HyvFdi5+pW0lszmretvcCvXds405oyRs qxFjYrPgZQuiSEo3t1Lc/jFPTxKLkSfI6CwY7nDpjIztRE9VDSEIiVc3UuA5V4i9WtLY +Sug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=J2AXC6ep3Mut8VNO5W2ceoPXK6rkaxE+J5EN1P6Rdd8=; b=v91ktny12N1Ubgr+zGwuiqUn6Mu2THVktZFhxuqX7AUf66dtZTdj4+KfvNGCoObR+t nByWtl2lkxmy15kQjHFGTwmc4J6NB9qd39ilbG5efoVnJKWoYt4fx2CybffhP5EUM8XX YF9xYVz/bXiHqhOcingvDROix/0lqN6MpeL8IbVjaxxTcU+cgMsIL4KOBJ/mqG+On34Z y8Tv4xRVwIVT/+p+spfgM45KhnO8YH2VfBPasDJ/rEDgHvU3j8uJG3S44KV+Vbc4IbZ4 XfVh8PmrInR96Pc8vsw9pob7Rc2OE6VacJdkP3wp94SpAD3SZciQyy+osCZsyu9ii3u6 yxaw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=Gj4ZghNa; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds10-20020a170907724a00b0093defbd6276si1937588ejc.1021.2023.03.25.01.36.11; Sat, 25 Mar 2023 01:36:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=Gj4ZghNa; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231985AbjCYI0n (ORCPT + 99 others); Sat, 25 Mar 2023 04:26:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231659AbjCYI0m (ORCPT ); Sat, 25 Mar 2023 04:26:42 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2131.outbound.protection.outlook.com [40.107.95.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48EEDDBF4; Sat, 25 Mar 2023 01:26:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZS9+gBPy7UrlqYPfQXqNFKYxd2gn5E0CNX24oHa9riZWd7QZCrmcxqCmN3HGsdSrl0flQs+x+lORp+I+xuBN2mORkNQTm5bZUO7h50AMygbr+9dH9unE+SOgpaL1XXLfGt6Z0g29vdB41cRb1GfvHYVVSELQMoT6qbBQHRDk43vnpn0d7VfhQzAkd3EU/SOTVFOFQEhePFtaBDzkg/62iWoRBbdLKQ7vgviqzWh4+r0nfuIFp7ZVe8DJRrxeNFQGfsIUfsuD4Mefd2JrLIIrm3OJLx0yenTW0/86KACp7ZXb2ITXN/97jNjax0ZufxYrUThwkGeR6wzDOPDnyAAccQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=J2AXC6ep3Mut8VNO5W2ceoPXK6rkaxE+J5EN1P6Rdd8=; b=BoX4h+GnaJv3PIpo5sCFu3W/rg4eHtbKB6aofEUVuyJgaYFpFQxd+xIZ3f0CTvN6DJwPhymY4zL+XeCQJO3P64c7daj1dpl95GZ+cBOTFp0wVOZvExLOOs+ls8Q8uEJEXw/igo5jcHkDZdhAzypbqgNnPNiRyAY21E9k2+zU/WtyEXlaomJElXr5hKyRTZRk3YIg59k46MGnOm+1nK+kIC6P5I8xFiry0Z7aXRV6aARmn3pEh9MRtwBBC5PpyN+eaFC2bwTXEfP+rMmfwTwuWUI3H7QVWhloKQF9STBnBTFtaT4yTpPgRDp3ChbUkLIISm5y36zdFQPCkStONI7DAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J2AXC6ep3Mut8VNO5W2ceoPXK6rkaxE+J5EN1P6Rdd8=; b=Gj4ZghNaZ+/NbszvoHwHTm9tVZzzpYNEuATKL+b29+ya7csw5QsKIKBm14SwkWMmQwvBehvLvhS/dJ6E54oJ3l/DVL95KCb4Q7osCSWkDcHUBmWGYk45+vy2aW40qUUUbpcQ1u+/oBSI9DDxMi/2z/quy49HXLDkHbz9MSNqBDg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by DM4PR13MB5834.namprd13.prod.outlook.com (2603:10b6:8:41::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.41; Sat, 25 Mar 2023 08:26:38 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::85f5:bdb:fb9e:294c]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::85f5:bdb:fb9e:294c%2]) with mapi id 15.20.6178.041; Sat, 25 Mar 2023 08:26:38 +0000 Date: Sat, 25 Mar 2023 09:26:31 +0100 From: Simon Horman To: Sean Anderson Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot , Dan Carpenter Subject: Re: [PATCH net-next v4 01/10] net: sunhme: Fix uninitialized return code Message-ID: References: <20230324175136.321588-1-seanga2@gmail.com> <20230324175136.321588-2-seanga2@gmail.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: AM9P195CA0005.EURP195.PROD.OUTLOOK.COM (2603:10a6:20b:21f::10) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|DM4PR13MB5834:EE_ X-MS-Office365-Filtering-Correlation-Id: 3710f2dd-bb93-4b58-2618-08db2d0aa738 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bUN3+odeOozRESBGO9ryTGQzW+MKjvW1w4T6tifk2oir11glRh2Mhtn9tzLbU30JPYakB3gYpeGDAb71tYinsG09ci0MdLMl3cd1IM21ftcpCGh9eaNchNW+ualCdAm9M6/BGHqjdqy6vHuawZKeZamySmFGduJIgXYcNZq6XQdDS30O6jzUg44u7/iklmwPwKuMU0MniH7YKITQpMbSkyjhKFeAqYkTtXZxvByaDR/rwcvuLCA2O5Ctx1gNG0+W8DLsOowovnFM+jGax5KqdrYuYnk90bGPCvV6os4A6zOpDkdQcXKzOupqS2Q8Fl6YgfMIQksSssSMezDJu1kbL3BHvTVhnOPDSxugUCEox83oLrgVX1RgSfYRiqBArusuYVx5i9XjZV8bR1OMoGjkRQmKPU+7s3Y9MCTSOFSCr27zvpxoNlAY5sixV127/ddt5sExWJeD0mrS0iwA0ngH+vflb7RNaQnttrrhydpCaIhm9ZhcAxy6tofPwfPxY8ks2Tc1tWO+gTnW5/IZja2jbiADuokokhx+nf7arUhe7Nk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39840400004)(376002)(136003)(346002)(396003)(451199021)(8676002)(6916009)(4326008)(83380400001)(2906002)(6486002)(66476007)(66556008)(44832011)(66946007)(186003)(6506007)(6512007)(5660300002)(86362001)(966005)(316002)(41300700001)(8936002)(54906003)(6666004)(38100700002)(478600001)(36756003)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?yZDv4RWEtQL+EEQnZ+EQsdOACXrdpAaKSctbOJXj1077/jYlbfLfbVjjRsti?= =?us-ascii?Q?tL3HJxQo5aMAXv5En3Q+wV/j1bVlFvHemyoT9W2jH/alVeVQVSsduInN93j+?= =?us-ascii?Q?1mcMBOHa9VLj9cOiSmWceEni7i6cOa9AWC8DJ4Qsnpz+XrNFBmCjirXb9zIC?= =?us-ascii?Q?Tu+749vkurnnemDnYr59B/H2fc49TPjdNvtuwr8k/d6yrTofBgHjnazrdOsW?= =?us-ascii?Q?KRc5OTBOZnSiZLOCNszV5/rHseeKex/blRDmxWEeNKdB08kMOqe7HtymfW1J?= =?us-ascii?Q?hHJRrTTuMo6a8yjLnQLRcta/499yqtlD6J04nJyHNf/XlpeJy0TyAficdvhx?= =?us-ascii?Q?J2GM1gBN3CsSZN0rSANZZJXAZPqbGm2xtNarHDXSZ9ixAgqLDJHMIW/C9/xw?= =?us-ascii?Q?psGhFVmYDTKEgLSaFwUUs3ECc2IEVoi3RAX/ZQ5hEVAUcfqEG7tdiCS4iOoE?= =?us-ascii?Q?cAIzqwDUa2Iee+MasUJj6n7rVd62+q+Z1ejyevB9s9+4iNiAsi98qHbj1BV+?= =?us-ascii?Q?JU571qYB661iETBE3kME0zRc6VgiokChzRXRW7uzNDpeI3p3YIs6i//5YErn?= =?us-ascii?Q?EenHe3L2LWLzoLg8W5s7i2Aa51ZCAVr+JI1X7ZDcTZHF/wi8onjLoAveVpoR?= =?us-ascii?Q?QbtK7k3jm5hpGkPgheJO+GHExelaIUSJvCj18WLudRMT9OwYuC0cxLx6A7Uu?= =?us-ascii?Q?EAAxX+qdC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6x6bQvHmLIGaGH6zdwN?= =?us-ascii?Q?bIIPsoyCIfi+2FTTPyLbtGK4MHjShOTp/FH5SDtRfRUDi7HufAOjxCChi861?= =?us-ascii?Q?vd8wiw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3710f2dd-bb93-4b58-2618-08db2d0aa738 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2023 08:26:38.4423 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0FXSkFGTRKRyrsjmTLcW/ynUdbCiazp6DwuKxilDpiUkdhrL3skUcrCMn3o6juYFzvezF6qsdmBj5P6t7pK7MENWROGUrJ1pCyuKp7d//Y0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR13MB5834 X-Spam-Status: No, score=-0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 25, 2023 at 09:17:03AM +0100, Simon Horman wrote: > Hi Sean, > > On Fri, Mar 24, 2023 at 01:51:27PM -0400, Sean Anderson wrote: > > Fix an uninitialized return code if we never found a qfe slot. It would be > > a bug if we ever got into this situation, but it's good to return something > > tracable. > > > > Fixes: acb3f35f920b ("sunhme: forward the error code from pci_enable_device()") > > I think it might be, > > Fixes: 5b3dc6dda6b1 ("sunhme: Regularize probe errors") > > > Reported-by: kernel test robot > > Reported-by: Dan Carpenter > > Checkpatch requests a Link tag after Reported-by tags. > > Link: https://lore.kernel.org/oe-kbuild/20230222135715.hjXBN9H5dr7nCnI_Ye2s5H--HsnWom4o9AMScThhDRM@z/T/ > > > Signed-off-by: Sean Anderson > > --- > > > > Changes in v4: > > - Move this fix to its own commit > > > > drivers/net/ethernet/sun/sunhme.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c > > index b0c7ab74a82e..7cf8210ebbec 100644 > > --- a/drivers/net/ethernet/sun/sunhme.c > > +++ b/drivers/net/ethernet/sun/sunhme.c > > @@ -2834,7 +2834,7 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, > > int i, qfe_slot = -1; > > char prom_name[64]; > > u8 addr[ETH_ALEN]; > > - int err; > > + int err = -ENODEV; > > > > /* Now make sure pci_dev cookie is there. */ > > #ifdef CONFIG_SPARC > > Unfortunately I don't think this is the right fix, > and indeed smatch still complains with it applied. > > The reason is that a few lines further down there is: > > err = pcim_enable_device(pdev); > if (err) > goto err_out; > > Which overrides the initialisation of err. > Before getting to the line that smatch highlights, correctly as far > as I can tell, as having a missing error code. > > if (qfe_slot == 4) > goto err_out; > > As err_out simply calls 'return err' one could just return here. > And perhaps that is a nice cleanup to roll out at some point. I see that point is patch 9/10, which also fixes the bug reported by smatch :) > But to be in keeping with the style of the function, as a minimal fix, > I think the following might be appropriate. > > Note, with this applied err doesn't need to be initialised at the top of > the function (as far as my invocation of smatch is concerned). > > diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c > index b0c7ab74a82e..d6df778a0052 100644 > --- a/drivers/net/ethernet/sun/sunhme.c > +++ b/drivers/net/ethernet/sun/sunhme.c > @@ -2863,8 +2863,10 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, > if (!qp->happy_meals[qfe_slot]) > break; > > - if (qfe_slot == 4) > + if (qfe_slot == 4) { > + err = -ENODEV; > goto err_out; > + } > } > > dev = devm_alloc_etherdev(&pdev->dev, sizeof(struct happy_meal)); >