From patchwork Wed Aug 14 19:28:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuan-Wei Chiu X-Patchwork-Id: 13763875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3EC52C52D7F for ; Wed, 14 Aug 2024 19:30:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=FsGUvb6nFho8UXWLIlzLPgIbTCVi+qz8AQbTtLtqEhA=; b=Neb8GUqMqQuShhKXvARkTdbVdM fX+Q2s18g2CgpvnDL7HcPDJ1J5Zy1PbaI9BjI6hX5YuRdBewV2QCanZB+3lrVcXl7HW2oTXthVFvs qmET23yzIi5VL4S+qhKcoTsTSXc3azgHP2YBCFEh3RQq2GW+W9OpBT7GD4WNwOkMtOPHLgrbyvmDj Y9Tnnj0a7DI/lHcwRMO8+paNnAZ2GUO4SUcIKYklr+d0+VYdHSD9uRxGVTm1zLcyU+XwuLUNTIoew ltPiN1CzO0/zHgLSv4m5bLCEqcJPpMJSB7BUGdGSlN3jSjZPitvG/xTOtTVGJgWuYsHzgPYY7Gmo9 9rN3hX9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seJhH-0000000844C-1Fl3; Wed, 14 Aug 2024 19:30:15 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seJgd-000000083rA-13QF for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 19:29:36 +0000 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-7c2595f5c35so35465a12.1 for ; Wed, 14 Aug 2024 12:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723663772; x=1724268572; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FsGUvb6nFho8UXWLIlzLPgIbTCVi+qz8AQbTtLtqEhA=; b=IGK7fMurMXfvaeBWIOa09AL9CYWfDmAzCKMScBhLl3PpZgVwuJi83TB0ILFBFnHehJ qGVHBfqEn8/TmVn1N8nXkHglMOmsXoNS50RluXTs7Tn9fjzkBuucYpMOSD9TcrB8hQHh jDdl0lZa5Nfok2ENkK7IXq9dqhFszTpDVjJ/TplW3Y3tlf7vZO8V5vZdFCM6FfprVal+ rL2hmfFBwJiE/cfz3K/3rs0jCFMqvmcAFo8So3l+xI3lVI136y3gD2d27oBmKbJtaN7b 728q+zmIYUEyM+fiQ6LEhwT7RCsBENKafSItJLapIT9Cx6wQ4JzjsfL+poc1ux6g4tRP ryzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723663772; x=1724268572; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FsGUvb6nFho8UXWLIlzLPgIbTCVi+qz8AQbTtLtqEhA=; b=mhVUV6ZSV0/5kQszsRQgOuADE3vEQWyxacYPSkpMWLx7P72BITcMabPfBarhc8FSXo KwP62zDVNFaPaSmPXoN+EXbeW/pvcpUp3P20o1eoqZbv9U7iVSTkc05ahaasqL08PlJL xi0UNxV3eFk73mFNi5a+sjsj7RpoPn/fvdlRY2Vr0eaqPUcvL1U3OdaUL2ynu1xIZc3I QOJqUxypVaeo0gGhBp0Ggytk+7Z8OqtocAjIJU5/KAFR/wLREhx4kF9SrkqbAL4I4J5p bQfsrl+stUXSeibRs/a47bNelmp0hmGlN5yKa5n0SRCgs+Rhi/HRhpYtSS6raFhmydnr u08Q== X-Forwarded-Encrypted: i=1; AJvYcCUMopQufBkArDOehODDZRcAuTJGC80k+d+1FcVVOLf/WWVDI9T5PTcHWs7b+42DbyPGnnaicW231h2lhi6WcR+B@lists.infradead.org X-Gm-Message-State: AOJu0YzXxFzfm7O173V8Nq/r/HF2a37HRMGudw4Xch5qvXNue24U/FiF rBNrSmi7uSJHU1k3I7RRvPucVMU91sAxD6hn+//Mx3azkBwS4NEpb6m+vA== X-Google-Smtp-Source: AGHT+IHospHNPoeh5XKwhWBVCuDX8BVHQu6fE2KBEqXKlLWSK7Ml6eaVy3HxHB6s8a+gtoVeqqOU1Q== X-Received: by 2002:a05:6a21:329f:b0:1c3:b106:d293 with SMTP id adf61e73a8af0-1c8f9faf08dmr135268637.3.1723663772363; Wed, 14 Aug 2024 12:29:32 -0700 (PDT) Received: from visitorckw-System-Product-Name.. ([140.113.216.168]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7c697a55b4bsm3540653a12.73.2024.08.14.12.29.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 12:29:31 -0700 (PDT) From: Kuan-Wei Chiu To: Mark Brown Cc: Michal Simek , Ching-Chun Huang , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Kuan-Wei Chiu Subject: [PATCH] spi: zynq-qspi: Replace kzalloc with kmalloc for buffer allocation Date: Thu, 15 Aug 2024 03:28:39 +0800 Message-Id: <20240814192839.345523-1-visitorckw@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_122935_331093_0729A699 X-CRM114-Status: GOOD ( 11.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In zynq_qspi_exec_mem_op(), the temporary buffer is allocated with kzalloc and then immediately initialized using memset to 0xff. To optimize this, replace kzalloc with kmalloc, as the zeroing operation is redundant and unnecessary. Signed-off-by: Kuan-Wei Chiu Reviewed-by: Michal Simek --- Note: Build test only. drivers/spi/spi-zynq-qspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-zynq-qspi.c b/drivers/spi/spi-zynq-qspi.c index d6325c6be3d4..b67455bda972 100644 --- a/drivers/spi/spi-zynq-qspi.c +++ b/drivers/spi/spi-zynq-qspi.c @@ -569,7 +569,7 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem, } if (op->dummy.nbytes) { - tmpbuf = kzalloc(op->dummy.nbytes, GFP_KERNEL); + tmpbuf = kmalloc(op->dummy.nbytes, GFP_KERNEL); if (!tmpbuf) return -ENOMEM;