ALSA: usb: fcp: Fix sparse warnings
Subsystems (2)
cover ALSA: usb: fcp: Fix sparse warnings
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(-)
Signature · 1 line
2.43.0
PATCH 1/3 ALSA: usb: fcp: Fix meter_levels type to __le32
The cached level meter values are returned from the USB core as __le32, hence declare properly.
--- sound/usb/fcp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/usb/fcp.c +4 -4
@@ -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 ;
Signature · 1 line
2.43.0
PATCH 2/3 ALSA: usb: fcp: Fix incorrect resp->opcode retrieval
In reply to Takashi IwaiFix a wrong conversion macro used for resp->opcode, which is __le32.
--- sound/usb/fcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/fcp.c +1 -1
@@ -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 ; }
Signature · 1 line
2.43.0
PATCH 3/3 ALSA: usb: fcp: Fix return code from poll ops
In reply to Takashi IwaiFix a sparse warning due to the invalid return type from poll ops, which is __poll_t.
--- sound/usb/fcp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/usb/fcp.c +5 -5
@@ -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; }
Signature · 1 line
2.43.0