Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3969372pxu; Mon, 12 Oct 2020 06:17:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyC7IRTqpMJA41x5lxilnDdccb0h2GHNj+69K5nXunJ7PQJMgId+RNtar5kEYctZSaYgUp2 X-Received: by 2002:a17:906:3e17:: with SMTP id k23mr29096703eji.414.1602508622583; Mon, 12 Oct 2020 06:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602508622; cv=none; d=google.com; s=arc-20160816; b=vUs+vuow0Y5RfVLyuP/9zZH0GiWCxUyrNHDHXL8arWE/+jF+s/sEoNPxDk5akgLR2C ktthCFNq9YXPskXaWLQ0baG+AtMBoKyAxkQHgKsAwnz3Hx9gpVPNpVsUxxAC2qRPHVsI Da3Vt+re4SsHomDTgDgPbKIvemnBM7e0jm7B3F0Y/7irdURHRO8UxmCmUcHMgGmXT7Zf fr/IbQZTHYxsCSoh9fC7os1y2c7ryLpNWDXV9QXSy26ikJHzAV31kwaOrIg5nSrtjIwq NWxq8oN8Xmj5fdc+VmiXtTNlCKbo9miR37/zxknpKOknhPvLntPEZeFGOwc0w7Ix1woW CQgA== 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:date:from:dkim-signature; bh=IRuRu6d50EbSzR6eJn8zTFBIpVvHOPQss0OJFKbt4rE=; b=IjuYNpDFi3qsLSCdfbgPGVsP+uO+sazZX72SmbtMdyL1nbXqtQC2EOg23R/DBrQdEL wcIUqj9Nkke3mXpYtPHRFwJsmcMRZQn0KccI5VW1dW9qMlmeOPSQ+ap+HibjnTZLR6/a qkpsO0qhDS+hCOePnl/t/yY+QDJG6tqhrYh1+EoSi1KYbPqeIxMw+FwQTXfragBVcKei TIytp5hMCf7oByn8VVXWUjiZXU4TUn8Xs1sIYGnYZ/uFopDsGJiIwH39oOEDVDzWSWQ9 EH+gbgo1LmLmNr1AgSpwITaTusr8oKfJJSmTHz4wdVM1GuAIdZaqBiiJiyXPuCM2dpwR 4EkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PdEG7lRf; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w5si4023045ede.427.2020.10.12.06.16.38; Mon, 12 Oct 2020 06:17: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=@gmail.com header.s=20161025 header.b=PdEG7lRf; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388160AbgJLLeW (ORCPT + 99 others); Mon, 12 Oct 2020 07:34:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387617AbgJLLeV (ORCPT ); Mon, 12 Oct 2020 07:34:21 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D99F0C0613CE; Mon, 12 Oct 2020 04:34:21 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id d6so8403501plo.13; Mon, 12 Oct 2020 04:34:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=IRuRu6d50EbSzR6eJn8zTFBIpVvHOPQss0OJFKbt4rE=; b=PdEG7lRfdR0pUwVfHV6Jbh+x9P1/KCp8yGwD3CMccR/aPvV/BOf5ChBDI2nSGCaQ8N 4IUaIBdJYTcm7lE98ugQbg4LqFFjbSKY+kZ2FMDlyNtwoOoZ+APcLL22gnmPlUGTBq1D mmjtT6gDVB0cAtMIjWpRhj0+7eEAV6tIe9t331u1SBekgietglZTE5BZJy5JotQw8eqa if9gOtwGn9m9PzDQm1f62uNpwSWCUytjacxb2Gwb9TL3umgNGKPlIk5XrANBJcr3rhnk vSppL5yDDND8GB4Egs6SMovu1EKi06NaK5c9eFhfqOo8vBrz8HJqeNSuWfueWKzaVnTG cW8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=IRuRu6d50EbSzR6eJn8zTFBIpVvHOPQss0OJFKbt4rE=; b=rpz5/IKS+eptHQf034BEb94Ipr73fUR99bz157dBE1Fa+gc6pXNZxtwZyTfvaNUoss f7vixFHrr8mfwMiwyt4KC9iKOZg7Hy3Kynj7MugJxNBrTgWdB/DY3oZrvlmDTzapqfh9 t4l94uJLGwtA7LHRBJwoo4GicBCuSCoU7q5flOds0wPQwmjXdohqMnKT4tZtDQb/iuwc pE0s/gdkEFFFhAd6VSJWOtnkIU9s4DsPA3ZB+Kxu6HY5WrMtPmwt5E25I9HgCJN+iOdH kMbq1oyyXzASZiWtWfDLZfii7cUND/aOrJbRTSgrRSfVYUockWo8O4/VFB8Tj74ZUBrA IOcA== X-Gm-Message-State: AOAM533JKRxb8u7HRUBQAnxtNiuxYGI5hmnvCkYe25NMY7miDWOxdLo9 AMb3BQI2zoXbA0RAITG36qpSrcHqn7VfBbQr X-Received: by 2002:a17:902:7242:b029:d4:c719:79ce with SMTP id c2-20020a1709027242b02900d4c71979cemr11851730pll.26.1602502461436; Mon, 12 Oct 2020 04:34:21 -0700 (PDT) Received: from localhost ([160.16.113.140]) by smtp.gmail.com with ESMTPSA id z6sm20350965pfg.12.2020.10.12.04.34.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 04:34:21 -0700 (PDT) From: Coiby Xu X-Google-Original-From: Coiby Xu Date: Mon, 12 Oct 2020 16:08:43 +0800 To: Willem de Bruijn Cc: devel@driverdev.osuosl.org, Benjamin Poirier , Shung-Hsi Yu , Manish Chopra , "supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER" , Greg Kroah-Hartman , open list , "open list:QLOGIC QLGE 10Gb ETHERNET DRIVER" Subject: Re: [PATCH v1 1/6] staging: qlge: Initialize devlink health dump framework for the dlge driver Message-ID: <20201012080843.7kh4xdk4ymaetza6@Rk> References: <20201008115808.91850-1-coiby.xu@gmail.com> <20201008115808.91850-2-coiby.xu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 08, 2020 at 08:22:44AM -0400, Willem de Bruijn wrote: >On Thu, Oct 8, 2020 at 7:58 AM Coiby Xu wrote: >> >> Initialize devlink health dump framework for the dlge driver so the >> coredump could be done via devlink. >> >> Signed-off-by: Coiby Xu > >> @@ -4556,6 +4559,13 @@ static int qlge_probe(struct pci_dev *pdev, >> struct ql_adapter *qdev = NULL; >> static int cards_found; >> int err = 0; >> + struct devlink *devlink; >> + struct qlge_devlink *ql_devlink; >> + >> + devlink = devlink_alloc(&qlge_devlink_ops, sizeof(struct qlge_devlink)); >> + if (!devlink) >> + return -ENOMEM; >> + ql_devlink = devlink_priv(devlink); >> >> ndev = alloc_etherdev_mq(sizeof(struct ql_adapter), >> min(MAX_CPUS, > >need to goto devlink_free instead of return -ENOMEM here, too. devlink_alloc return NULL only if kzalloc return NULL. So we shouldn't go to devlink_free which will call kfree. > >> @@ -4614,6 +4624,16 @@ static int qlge_probe(struct pci_dev *pdev, >> free_netdev(ndev); >> return err; > >and here But I should goto devlink_free here. Thank you for pointing out my neglect. > >> } >> + >> + err = devlink_register(devlink, &pdev->dev); >> + if (err) { >> + goto devlink_free; >> + } >> + >> + qlge_health_create_reporters(ql_devlink); >> + ql_devlink->qdev = qdev; >> + ql_devlink->ndev = ndev; >> + qdev->ql_devlink = ql_devlink; >> /* Start up the timer to trigger EEH if >> * the bus goes dead >> */ >> @@ -4624,6 +4644,10 @@ static int qlge_probe(struct pci_dev *pdev, >> atomic_set(&qdev->lb_count, 0); >> cards_found++; >> return 0; >> + >> +devlink_free: >> + devlink_free(devlink); >> + return err; >> } -- Best regards, Coiby