mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Hans de Goede <hdegoede@redhat.com>,
	Alexander Usyskin <alexander.usyskin@intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 6.12 16/37] mei: vsc: Use struct vsc_tp_packet as vsc-tp tx_buf and rx_buf type
Date: Tue, 29 Apr 2025 19:51:01 -0400	[thread overview]
Message-ID: <20250429235122.537321-16-sashal@kernel.org> (raw)
In-Reply-To: <20250429235122.537321-1-sashal@kernel.org>

From: Hans de Goede <hdegoede@redhat.com>

[ Upstream commit f88c0c72ffb014e5eba676ee337c4eb3b1d6a119 ]

vsc_tp.tx_buf and vsc_tp.rx_buf point to a struct vsc_tp_packet, use
the correct type instead of "void *" and use sizeof(*ptr) when allocating
memory for these buffers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Alexander Usyskin <alexander.usyskin@intel.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Link: https://lore.kernel.org/r/20250318141203.94342-3-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/misc/mei/vsc-tp.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/misc/mei/vsc-tp.c b/drivers/misc/mei/vsc-tp.c
index ef0a9f423c8f8..fb2f45829f7bd 100644
--- a/drivers/misc/mei/vsc-tp.c
+++ b/drivers/misc/mei/vsc-tp.c
@@ -67,8 +67,8 @@ struct vsc_tp {
 	u32 seq;
 
 	/* command buffer */
-	void *tx_buf;
-	void *rx_buf;
+	struct vsc_tp_packet *tx_buf;
+	struct vsc_tp_packet *rx_buf;
 
 	atomic_t assert_cnt;
 	wait_queue_head_t xfer_wait;
@@ -160,7 +160,7 @@ static int vsc_tp_xfer_helper(struct vsc_tp *tp, struct vsc_tp_packet *pkt,
 {
 	int ret, offset = 0, cpy_len, src_len, dst_len = sizeof(struct vsc_tp_packet);
 	int next_xfer_len = VSC_TP_PACKET_SIZE(pkt) + VSC_TP_XFER_TIMEOUT_BYTES;
-	u8 *src, *crc_src, *rx_buf = tp->rx_buf;
+	u8 *src, *crc_src, *rx_buf = (u8 *)tp->rx_buf;
 	int count_down = VSC_TP_MAX_XFER_COUNT;
 	u32 recv_crc = 0, crc = ~0;
 	struct vsc_tp_packet ack;
@@ -320,7 +320,7 @@ int vsc_tp_rom_xfer(struct vsc_tp *tp, const void *obuf, void *ibuf, size_t len)
 	guard(mutex)(&tp->mutex);
 
 	/* rom xfer is big endian */
-	cpu_to_be32_array(tp->tx_buf, obuf, words);
+	cpu_to_be32_array((u32 *)tp->tx_buf, obuf, words);
 
 	ret = read_poll_timeout(gpiod_get_value_cansleep, ret,
 				!ret, VSC_TP_ROM_XFER_POLL_DELAY_US,
@@ -336,7 +336,7 @@ int vsc_tp_rom_xfer(struct vsc_tp *tp, const void *obuf, void *ibuf, size_t len)
 		return ret;
 
 	if (ibuf)
-		be32_to_cpu_array(ibuf, tp->rx_buf, words);
+		be32_to_cpu_array(ibuf, (u32 *)tp->rx_buf, words);
 
 	return ret;
 }
@@ -492,11 +492,11 @@ static int vsc_tp_probe(struct spi_device *spi)
 	if (!tp)
 		return -ENOMEM;
 
-	tp->tx_buf = devm_kzalloc(dev, VSC_TP_MAX_XFER_SIZE, GFP_KERNEL);
+	tp->tx_buf = devm_kzalloc(dev, sizeof(*tp->tx_buf), GFP_KERNEL);
 	if (!tp->tx_buf)
 		return -ENOMEM;
 
-	tp->rx_buf = devm_kzalloc(dev, VSC_TP_MAX_XFER_SIZE, GFP_KERNEL);
+	tp->rx_buf = devm_kzalloc(dev, sizeof(*tp->rx_buf), GFP_KERNEL);
 	if (!tp->rx_buf)
 		return -ENOMEM;
 
-- 
2.39.5


  parent reply	other threads:[~2025-04-29 23:51 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29 23:50 [PATCH AUTOSEL 6.12 01/37] cpufreq: Add SM8650 to cpufreq-dt-platdev blocklist Sasha Levin
2025-04-29 23:50 ` [PATCH AUTOSEL 6.12 02/37] cpufreq: Do not enable by default during compile testing Sasha Levin
2025-04-29 23:50 ` [PATCH AUTOSEL 6.12 03/37] nvmem: rockchip-otp: Move read-offset into variant-data Sasha Levin
2025-04-29 23:50 ` [PATCH AUTOSEL 6.12 04/37] nvmem: rockchip-otp: add rk3576 variant data Sasha Levin
2025-04-29 23:50 ` [PATCH AUTOSEL 6.12 05/37] nvmem: core: fix bit offsets of more than one byte Sasha Levin
2025-04-29 23:50 ` [PATCH AUTOSEL 6.12 06/37] nvmem: core: verify cell's raw_len Sasha Levin
2025-04-29 23:50 ` [PATCH AUTOSEL 6.12 07/37] nvmem: core: update raw_len if the bit reading is required Sasha Levin
2025-04-29 23:50 ` [PATCH AUTOSEL 6.12 08/37] nvmem: qfprom: switch to 4-byte aligned reads Sasha Levin
2025-04-29 23:50 ` [PATCH AUTOSEL 6.12 09/37] scsi: target: iscsi: Fix timeout on deleted connection Sasha Levin
2025-04-29 23:50 ` [PATCH AUTOSEL 6.12 10/37] scsi: ufs: Introduce quirk to extend PA_HIBERN8TIME for UFS devices Sasha Levin
2025-04-29 23:50 ` [PATCH AUTOSEL 6.12 11/37] virtio_ring: Fix data race by tagging event_triggered as racy for KCSAN Sasha Levin
2025-04-29 23:50 ` [PATCH AUTOSEL 6.12 12/37] dma/mapping.c: dev_dbg support for dma_addressing_limited Sasha Levin
2025-04-29 23:50 ` [PATCH AUTOSEL 6.12 13/37] intel_th: avoid using deprecated page->mapping, index fields Sasha Levin
2025-04-29 23:50 ` [PATCH AUTOSEL 6.12 14/37] driver core: introduce device_set_driver() helper Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 15/37] driver core: fix potential NULL pointer dereference in dev_uevent() Sasha Levin
2025-04-29 23:51 ` Sasha Levin [this message]
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 17/37] dma-mapping: avoid potential unused data compilation warning Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 18/37] cgroup: Fix compilation issue due to cgroup_mutex not being exported Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 19/37] vhost_task: fix vhost_task_create() documentation Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 20/37] vhost-scsi: protect vq->log_used with vq->mutex Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 21/37] scsi: mpi3mr: Add level check to control event logging Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 22/37] net: enetc: refactor bulk flipping of RX buffers to separate function Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 23/37] dma-mapping: Fix warning reported for missing prototype Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 24/37] ima: process_measurement() needlessly takes inode_lock() on MAY_READ Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 25/37] fs/buffer: split locking for pagecache lookups Sasha Levin
2025-04-30  0:48   ` Luis Chamberlain
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 26/37] fs/buffer: introduce sleeping flavors " Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 27/37] fs/buffer: use sleeping version of __find_get_block() Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 28/37] fs/ocfs2: " Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 29/37] fs/jbd2: " Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 30/37] fs/ext4: use sleeping version of sb_find_get_block() Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 31/37] drm/amd/display: Enable urgent latency adjustment on DCN35 Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 32/37] drm/amdgpu: Allow P2P access through XGMI Sasha Levin
2025-04-30 12:58   ` Alex Deucher
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 33/37] selftests/bpf: Mitigate sockmap_ktls disconnect_after_delete failure Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 34/37] block: fix race between set_blocksize and read paths Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 35/37] io_uring: don't duplicate flushing in io_req_post_cqe Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 36/37] bpf: fix possible endless loop in BPF map iteration Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 37/37] samples/bpf: Fix compilation failure for samples/bpf on LoongArch Fedora Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250429235122.537321-16-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=alexander.usyskin@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®