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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 DA302C43331 for ; Fri, 8 Nov 2019 00:25:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9641C2084C for ; Fri, 8 Nov 2019 00:25:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726219AbfKHAZx (ORCPT ); Thu, 7 Nov 2019 19:25:53 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:50698 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbfKHAZx (ORCPT ); Thu, 7 Nov 2019 19:25:53 -0500 Received: from localhost (unknown [IPv6:2601:601:9f00:1e2::d71]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id E847915385D74; Thu, 7 Nov 2019 16:25:50 -0800 (PST) Date: Thu, 07 Nov 2019 16:25:50 -0800 (PST) Message-Id: <20191107.162550.125702977926999669.davem@davemloft.net> To: jeffrey.t.kirsher@intel.com Cc: anirudh.venkataramanan@intel.com, netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com, anthony.l.nguyen@intel.com, andrewx.bowers@intel.com Subject: Re: [net-next 01/15] ice: Use ice_ena_vsi and ice_dis_vsi in DCB configuration flow From: David Miller In-Reply-To: <20191107221438.17994-2-jeffrey.t.kirsher@intel.com> References: <20191107221438.17994-1-jeffrey.t.kirsher@intel.com> <20191107221438.17994-2-jeffrey.t.kirsher@intel.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 07 Nov 2019 16:25:51 -0800 (PST) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jeff Kirsher Date: Thu, 7 Nov 2019 14:14:24 -0800 > @@ -169,15 +170,23 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked) > } > > /* Store old config in case FW config fails */ > - old_cfg = devm_kzalloc(&pf->pdev->dev, sizeof(*old_cfg), GFP_KERNEL); > - memcpy(old_cfg, curr_cfg, sizeof(*old_cfg)); > + old_cfg = kmemdup(curr_cfg, sizeof(*old_cfg), GFP_KERNEL); Why not use devm_kmemdup()? Then you don't have to add the kfree() code paths.