public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] ALSA: usb: fcp: Fix sparse warnings
@ 2025-01-21 17:00 Takashi Iwai
  2025-01-21 17:00 ` [PATCH 1/3] ALSA: usb: fcp: Fix meter_levels type to __le32 Takashi Iwai
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Takashi Iwai @ 2025-01-21 17:00 UTC (permalink / raw)
  To: linux-sound; +Cc: Geoffrey D . Bennett

We got a few sparse warnings, and this patchset addresses those.

sound/usb/fcp.c:267:17: warning: cast to restricted __le16
sound/usb/fcp.c:267:17: warning: cast from restricted __le32
sound/usb/fcp.c:415:43: warning: cast to restricted __le32
sound/usb/fcp.c:890:22: warning: incorrect type in assignment (different base types)
sound/usb/fcp.c:890:22:    expected restricted __poll_t ( *poll )( ... )
sound/usb/fcp.c:890:22:    got unsigned int ( * )( ... )


Takashi

===

Takashi Iwai (3):
  ALSA: usb: fcp: Fix meter_levels type to __le32
  ALSA: usb: fcp: Fix incorrect resp->opcode retrieval
  ALSA: usb: fcp: Fix return code from poll ops

 sound/usb/fcp.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] ALSA: usb: fcp: Fix meter_levels type to __le32
  2025-01-21 17:00 [PATCH 0/3] ALSA: usb: fcp: Fix sparse warnings Takashi Iwai
@ 2025-01-21 17:00 ` Takashi Iwai
  2025-01-21 17:00 ` [PATCH 2/3] ALSA: usb: fcp: Fix incorrect resp->opcode retrieval Takashi Iwai
  2025-01-21 17:00 ` [PATCH 3/3] ALSA: usb: fcp: Fix return code from poll ops Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2025-01-21 17:00 UTC (permalink / raw)
  To: linux-sound; +Cc: Geoffrey D . Bennett

The cached level meter values are returned from the USB core as
__le32, hence declare properly.

Fixes: 46757a3e7d50 ("ALSA: FCP: Add Focusrite Control Protocol driver")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501212331.SaePSmsA-lkp@intel.com/
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/fcp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/usb/fcp.c b/sound/usb/fcp.c
index ecdd18335ab7..92e3caab0b82 100644
--- a/sound/usb/fcp.c
+++ b/sound/usb/fcp.c
@@ -100,7 +100,7 @@ struct fcp_data {
 
 	u8                   num_meter_slots;
 	s16                 *meter_level_map;
-	u32                 *meter_levels;
+	__le32              *meter_levels;
 	struct snd_kcontrol *meter_ctl;
 
 	unsigned int *meter_labels_tlv;
@@ -383,7 +383,7 @@ static int fcp_meter_ctl_get(struct snd_kcontrol *kctl,
 	struct usb_mixer_interface *mixer = elem->head.mixer;
 	struct fcp_data *private = mixer->private_data;
 	int num_meter_slots, resp_size;
-	u32 *resp = private->meter_levels;
+	__le32 *resp = private->meter_levels;
 	int i, err = 0;
 
 	struct {
@@ -655,7 +655,7 @@ static int fcp_ioctl_set_meter_map(struct usb_mixer_interface *mixer,
 	/* If the control doesn't exist, create it */
 	if (!private->meter_ctl) {
 		s16 *new_map __free(kfree) = NULL;
-		u32 *meter_levels __free(kfree) = NULL;
+		__le32 *meter_levels __free(kfree) = NULL;
 
 		/* Allocate buffer for the map */
 		new_map = kmalloc_array(map.map_size, sizeof(s16), GFP_KERNEL);
@@ -663,7 +663,7 @@ static int fcp_ioctl_set_meter_map(struct usb_mixer_interface *mixer,
 			return -ENOMEM;
 
 		/* Allocate buffer for reading meter levels */
-		meter_levels = kmalloc_array(map.meter_slots, sizeof(u32),
+		meter_levels = kmalloc_array(map.meter_slots, sizeof(__le32),
 					     GFP_KERNEL);
 		if (!meter_levels)
 			return -ENOMEM;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] ALSA: usb: fcp: Fix incorrect resp->opcode retrieval
  2025-01-21 17:00 [PATCH 0/3] ALSA: usb: fcp: Fix sparse warnings Takashi Iwai
  2025-01-21 17:00 ` [PATCH 1/3] ALSA: usb: fcp: Fix meter_levels type to __le32 Takashi Iwai
@ 2025-01-21 17:00 ` Takashi Iwai
  2025-01-21 17:00 ` [PATCH 3/3] ALSA: usb: fcp: Fix return code from poll ops Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2025-01-21 17:00 UTC (permalink / raw)
  To: linux-sound; +Cc: Geoffrey D . Bennett

Fix a wrong conversion macro used for resp->opcode, which is __le32.

Fixes: 46757a3e7d50 ("ALSA: FCP: Add Focusrite Control Protocol driver")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501212331.SaePSmsA-lkp@intel.com/
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/fcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/usb/fcp.c b/sound/usb/fcp.c
index 92e3caab0b82..cfa131b35e43 100644
--- a/sound/usb/fcp.c
+++ b/sound/usb/fcp.c
@@ -266,7 +266,7 @@ static int fcp_usb(struct usb_mixer_interface *mixer, u32 opcode,
 	if (req->opcode != resp->opcode) {
 		usb_audio_err(mixer->chip,
 			      "FCP response %08x opcode mismatch %08x\n",
-			      opcode, le16_to_cpu(resp->opcode));
+			      opcode, le32_to_cpu(resp->opcode));
 		return -EINVAL;
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] ALSA: usb: fcp: Fix return code from poll ops
  2025-01-21 17:00 [PATCH 0/3] ALSA: usb: fcp: Fix sparse warnings Takashi Iwai
  2025-01-21 17:00 ` [PATCH 1/3] ALSA: usb: fcp: Fix meter_levels type to __le32 Takashi Iwai
  2025-01-21 17:00 ` [PATCH 2/3] ALSA: usb: fcp: Fix incorrect resp->opcode retrieval Takashi Iwai
@ 2025-01-21 17:00 ` Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2025-01-21 17:00 UTC (permalink / raw)
  To: linux-sound; +Cc: Geoffrey D . Bennett

Fix a sparse warning due to the invalid return type from poll ops,
which is __poll_t.

Fixes: 46757a3e7d50 ("ALSA: FCP: Add Focusrite Control Protocol driver")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/fcp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/usb/fcp.c b/sound/usb/fcp.c
index cfa131b35e43..7df65041ace5 100644
--- a/sound/usb/fcp.c
+++ b/sound/usb/fcp.c
@@ -843,18 +843,18 @@ static long fcp_hwdep_read(struct snd_hwdep *hw, char __user *buf,
 	return sizeof(event);
 }
 
-static unsigned int fcp_hwdep_poll(struct snd_hwdep *hw,
-				   struct file *file,
-				   poll_table *wait)
+static __poll_t fcp_hwdep_poll(struct snd_hwdep *hw,
+			       struct file *file,
+			       poll_table *wait)
 {
 	struct usb_mixer_interface *mixer = hw->private_data;
 	struct fcp_data *private = mixer->private_data;
-	unsigned int mask = 0;
+	__poll_t mask = 0;
 
 	poll_wait(file, &private->notify.queue, wait);
 
 	if (private->notify.event)
-		mask |= POLLIN | POLLRDNORM;
+		mask |= EPOLLIN | EPOLLRDNORM;
 
 	return mask;
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-21 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-21 17:00 [PATCH 0/3] ALSA: usb: fcp: Fix sparse warnings Takashi Iwai
2025-01-21 17:00 ` [PATCH 1/3] ALSA: usb: fcp: Fix meter_levels type to __le32 Takashi Iwai
2025-01-21 17:00 ` [PATCH 2/3] ALSA: usb: fcp: Fix incorrect resp->opcode retrieval Takashi Iwai
2025-01-21 17:00 ` [PATCH 3/3] ALSA: usb: fcp: Fix return code from poll ops Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox