Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10417875ybi; Wed, 24 Jul 2019 22:51:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzV/YT6Z48cHKVImwV9jYpPy3ilH0/BaULNTX/LfRsx+WE+1ePuqoA4MH0fr89qER2zGZzM X-Received: by 2002:a63:c013:: with SMTP id h19mr54649017pgg.108.1564033913404; Wed, 24 Jul 2019 22:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564033913; cv=none; d=google.com; s=arc-20160816; b=m9KjI0V5hddwUYVT1EUZUYDyWkK1nn7RfIkAP82JdjGb+C9E1wBu8HxVIdX6x+soIB GgOMXG+qQppJWKMfnHohz7SP7Kr2IM4JGVXgfMUMjwdxZQEOLWbhQZm2GBXcW9pEAxKH 3shEHPaThys9MKaMpUCdSlpxZhpd824Qbglgz0CAvsfyC1eNvnbNVJvISvSOiMiFYNnf eqcbVopVRrtGHQrWYo2Y54eyF2c4tSMRwnLYjZEMfL+vpVwSDcwFESRJKSNdLIILCYb7 bRgiqkzevClio5xgY7lnT5r+et1zU0V7DfWxjaUijiXN1+35CXfmQIyslus57dfAug/L ugIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=r6xcP5bA0sOT1XKD434f1tzHJ1w8Z5pUhBurvR0md3Y=; b=nTkgbuYl8EymEb1yZJNScxW0uhbF8opxuNKviCYw1dgvnmxZkWFr+4y1lfrLcSLlX4 cLVOuBTT8ylHr/CigEDjzXuLQk/PO1/Yaq4iN/51CKXO6lKbMFjaKY+IDZDDXhxaO/KU 5hUm5BpFpF0kV43MbUfMJmW7eV+Pb+OSMbeLtwG+Bbc0oHTipLg48amakJkGDRIN5Y2c 5IyWIlgnnApLlW8je1PqnPgoz9m9bA3ydqtUtbsaHiQvfke+uJJMat/dCHp9VMlqJGkd FNXhuVSD+dAbVq5kHfpVxCwnxvXKBBab//61DfTeoIiKkyHuzLm6xcEoacnxDfaPyO/P SVpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=OS7tR5zy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d34si16291365pld.54.2019.07.24.22.51.38; Wed, 24 Jul 2019 22:51:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=OS7tR5zy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388943AbfGYCJb (ORCPT + 99 others); Wed, 24 Jul 2019 22:09:31 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35987 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387963AbfGYCJa (ORCPT ); Wed, 24 Jul 2019 22:09:30 -0400 Received: by mail-pf1-f194.google.com with SMTP id r7so21874326pfl.3 for ; Wed, 24 Jul 2019 19:09:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=r6xcP5bA0sOT1XKD434f1tzHJ1w8Z5pUhBurvR0md3Y=; b=OS7tR5zyV52UK8u0O/4vWdCPtirPj+DX3kR5Qgo2YISvEdfPqAmP6f7NJy+3klPmT4 RfiJkeso73KofXRUuat2uX68lTB2nU+lTIoDsvW+XXbqveTSN22AxhIXfvTl1OPmEGOX DH3L7/9/XwY5TeTaDs6ABHYUM5FB1G0P87Pr1+h/ZEgE/aGHr9TSGUmLgFDYzYzqlESP 1iAG/50feaU5Wpnt7JFSAudk6bjOxCwMgQE2p0Aw+aNMQHkFGspQpD8Jd1B6o/qaNIi6 T5cdmRleLEqVXZqLsvnAhx+nQAuZlQQO0MSsTDOGkl5s4M6GF7nA2xY1Q2icg/YVFy96 pCIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=r6xcP5bA0sOT1XKD434f1tzHJ1w8Z5pUhBurvR0md3Y=; b=TthDulgdbsCLs5/liA0/ESW7zj+VRc4WBoBtLPqB0D+HRJ7B2XkvQ+5WU3+2bdlGuQ 34YFYl/bZIKj2VVRBlASuuXBqgLmXFXMY9FNxbFMScFwm8sUNv42JFM37SDrEAbEMpmh 3z4ytJmLuTIbMyeADw1JozjwWK7fJtgkj1qeg/o83io7eMT7ApNjj1IHOPliY142SZ+u rp+46Y7KZNMVUHf7A7RGIUHqew6a1rAcMktuvYBeSPjqXga6KVOsGtdHod5Sr+i4II/s XwupmF8Slj1KcgUlMtjXZvu3HYgkhIXQu/QO/Mlr4xarZSF02MLjoTPTs0i/JPOe4JRA TzFQ== X-Gm-Message-State: APjAAAWGxKb9fFRCylmIlQ+Z3KfNtYHhR7gXJYhZ+04AiWwjUZgF7buz 0EmVnvIaDWx7L2Nevz/jVLUikUUcZqc= X-Received: by 2002:a17:90a:2430:: with SMTP id h45mr92683720pje.14.1564020569953; Wed, 24 Jul 2019 19:09:29 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id q1sm56990685pfg.84.2019.07.24.19.09.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 24 Jul 2019 19:09:29 -0700 (PDT) From: Chuhong Yuan Cc: Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH] ALSA: echoaudio: Replace kmalloc + memcpy with kmemdup Date: Thu, 25 Jul 2019 10:09:24 +0800 Message-Id: <20190725020924.7643-1-hslester96@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of using kmalloc + memcpy, use kmemdup to simplify the code. Signed-off-by: Chuhong Yuan --- sound/pci/echoaudio/echoaudio.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index b612a536a5a1..ca9125726be2 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -2189,11 +2189,10 @@ static int snd_echo_resume(struct device *dev) u32 pipe_alloc_mask; int err; - commpage_bak = kmalloc(sizeof(*commpage), GFP_KERNEL); + commpage = chip->comm_page; + commpage_bak = kmemdup(commpage, sizeof(*commpage), GFP_KERNEL); if (commpage_bak == NULL) return -ENOMEM; - commpage = chip->comm_page; - memcpy(commpage_bak, commpage, sizeof(*commpage)); err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device); if (err < 0) { -- 2.20.1