2022-10-24 21:50:30

by Jason A. Donenfeld

[permalink] [raw]
Subject: [PATCH] ALSA: rme9652: use explicitly signed char

With char becoming unsigned by default, and with `char` alone being
ambiguous and based on architecture, signed chars need to be marked
explicitly as such. This fixes warnings like:

sound/pci/rme9652/hdsp.c:3953 hdsp_channel_buffer_location() warn: 'hdsp->channel_map[channel]' is unsigned
sound/pci/rme9652/hdsp.c:4153 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)'
sound/pci/rme9652/rme9652.c:1833 rme9652_channel_buffer_location() warn: 'rme9652->channel_map[channel]' is unsigned

Cc: Jaroslav Kysela <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: [email protected]
Signed-off-by: Jason A. Donenfeld <[email protected]>
---
sound/pci/rme9652/hdsp.c | 26 +++++++++++++-------------
sound/pci/rme9652/rme9652.c | 22 +++++++++++-----------
2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index dcc43a81ae0e..902508e4fecc 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -433,7 +433,7 @@ struct hdsp_midi {
struct snd_rawmidi *rmidi;
struct snd_rawmidi_substream *input;
struct snd_rawmidi_substream *output;
- char istimer; /* timer in use */
+ bool istimer; /* timer in use */
struct timer_list timer;
spinlock_t lock;
int pending;
@@ -480,7 +480,7 @@ struct hdsp {
pid_t playback_pid;
int running;
int system_sample_rate;
- const char *channel_map;
+ const signed char *channel_map;
int dev;
int irq;
unsigned long port;
@@ -502,7 +502,7 @@ struct hdsp {
where the data for that channel can be read/written from/to.
*/

-static const char channel_map_df_ss[HDSP_MAX_CHANNELS] = {
+static const signed char channel_map_df_ss[HDSP_MAX_CHANNELS] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25
};
@@ -517,7 +517,7 @@ static const char channel_map_mf_ss[HDSP_MAX_CHANNELS] = { /* Multiface */
-1, -1, -1, -1, -1, -1, -1, -1
};

-static const char channel_map_ds[HDSP_MAX_CHANNELS] = {
+static const signed char channel_map_ds[HDSP_MAX_CHANNELS] = {
/* ADAT channels are remapped */
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23,
/* channels 12 and 13 are S/PDIF */
@@ -526,7 +526,7 @@ static const char channel_map_ds[HDSP_MAX_CHANNELS] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};

-static const char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = {
+static const signed char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = {
/* ADAT channels */
0, 1, 2, 3, 4, 5, 6, 7,
/* SPDIF */
@@ -540,7 +540,7 @@ static const char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = {
-1, -1
};

-static const char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = {
+static const signed char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = {
/* ADAT */
1, 3, 5, 7,
/* SPDIF */
@@ -554,7 +554,7 @@ static const char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = {
-1, -1, -1, -1, -1, -1
};

-static const char channel_map_H9632_qs[HDSP_MAX_CHANNELS] = {
+static const signed char channel_map_H9632_qs[HDSP_MAX_CHANNELS] = {
/* ADAT is disabled in this mode */
/* SPDIF */
8, 9,
@@ -3939,7 +3939,7 @@ static snd_pcm_uframes_t snd_hdsp_hw_pointer(struct snd_pcm_substream *substream
return hdsp_hw_pointer(hdsp);
}

-static char *hdsp_channel_buffer_location(struct hdsp *hdsp,
+static signed char *hdsp_channel_buffer_location(struct hdsp *hdsp,
int stream,
int channel)

@@ -3964,7 +3964,7 @@ static int snd_hdsp_playback_copy(struct snd_pcm_substream *substream,
void __user *src, unsigned long count)
{
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

if (snd_BUG_ON(pos + count > HDSP_CHANNEL_BUFFER_BYTES))
return -EINVAL;
@@ -3982,7 +3982,7 @@ static int snd_hdsp_playback_copy_kernel(struct snd_pcm_substream *substream,
void *src, unsigned long count)
{
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

channel_buf = hdsp_channel_buffer_location(hdsp, substream->pstr->stream, channel);
if (snd_BUG_ON(!channel_buf))
@@ -3996,7 +3996,7 @@ static int snd_hdsp_capture_copy(struct snd_pcm_substream *substream,
void __user *dst, unsigned long count)
{
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

if (snd_BUG_ON(pos + count > HDSP_CHANNEL_BUFFER_BYTES))
return -EINVAL;
@@ -4014,7 +4014,7 @@ static int snd_hdsp_capture_copy_kernel(struct snd_pcm_substream *substream,
void *dst, unsigned long count)
{
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

channel_buf = hdsp_channel_buffer_location(hdsp, substream->pstr->stream, channel);
if (snd_BUG_ON(!channel_buf))
@@ -4028,7 +4028,7 @@ static int snd_hdsp_hw_silence(struct snd_pcm_substream *substream,
unsigned long count)
{
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel);
if (snd_BUG_ON(!channel_buf))
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index 1d614fe89a6a..e7c320afefe8 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -230,7 +230,7 @@ struct snd_rme9652 {
int last_spdif_sample_rate; /* so that we can catch externally ... */
int last_adat_sample_rate; /* ... induced rate changes */

- const char *channel_map;
+ const signed char *channel_map;

struct snd_card *card;
struct snd_pcm *pcm;
@@ -247,12 +247,12 @@ struct snd_rme9652 {
where the data for that channel can be read/written from/to.
*/

-static const char channel_map_9652_ss[26] = {
+static const signed char channel_map_9652_ss[26] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25
};

-static const char channel_map_9636_ss[26] = {
+static const signed char channel_map_9636_ss[26] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
/* channels 16 and 17 are S/PDIF */
24, 25,
@@ -260,7 +260,7 @@ static const char channel_map_9636_ss[26] = {
-1, -1, -1, -1, -1, -1, -1, -1
};

-static const char channel_map_9652_ds[26] = {
+static const signed char channel_map_9652_ds[26] = {
/* ADAT channels are remapped */
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23,
/* channels 12 and 13 are S/PDIF */
@@ -269,7 +269,7 @@ static const char channel_map_9652_ds[26] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};

-static const char channel_map_9636_ds[26] = {
+static const signed char channel_map_9636_ds[26] = {
/* ADAT channels are remapped */
1, 3, 5, 7, 9, 11, 13, 15,
/* channels 8 and 9 are S/PDIF */
@@ -1819,7 +1819,7 @@ static snd_pcm_uframes_t snd_rme9652_hw_pointer(struct snd_pcm_substream *substr
return rme9652_hw_pointer(rme9652);
}

-static char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652,
+static signed char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652,
int stream,
int channel)

@@ -1847,7 +1847,7 @@ static int snd_rme9652_playback_copy(struct snd_pcm_substream *substream,
void __user *src, unsigned long count)
{
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES))
return -EINVAL;
@@ -1867,7 +1867,7 @@ static int snd_rme9652_playback_copy_kernel(struct snd_pcm_substream *substream,
void *src, unsigned long count)
{
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

channel_buf = rme9652_channel_buffer_location(rme9652,
substream->pstr->stream,
@@ -1883,7 +1883,7 @@ static int snd_rme9652_capture_copy(struct snd_pcm_substream *substream,
void __user *dst, unsigned long count)
{
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES))
return -EINVAL;
@@ -1903,7 +1903,7 @@ static int snd_rme9652_capture_copy_kernel(struct snd_pcm_substream *substream,
void *dst, unsigned long count)
{
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

channel_buf = rme9652_channel_buffer_location(rme9652,
substream->pstr->stream,
@@ -1919,7 +1919,7 @@ static int snd_rme9652_hw_silence(struct snd_pcm_substream *substream,
unsigned long count)
{
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

channel_buf = rme9652_channel_buffer_location (rme9652,
substream->pstr->stream,
--
2.38.1


2022-10-24 23:32:01

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] ALSA: rme9652: use explicitly signed char

Hi Jason,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on crng-random/master linus/master v6.1-rc2 next-20221024]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Jason-A-Donenfeld/ALSA-rme9652-use-explicitly-signed-char/20221025-003249
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link: https://lore.kernel.org/r/20221024162947.536060-1-Jason%40zx2c4.com
patch subject: [PATCH] ALSA: rme9652: use explicitly signed char
config: ia64-allyesconfig
compiler: ia64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3ec2c3ce47e18e3b4bfc225baf73d4420d6057c2
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Jason-A-Donenfeld/ALSA-rme9652-use-explicitly-signed-char/20221025-003249
git checkout 3ec2c3ce47e18e3b4bfc225baf73d4420d6057c2
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash sound/pci/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

sound/pci/rme9652/hdsp.c: In function 'snd_hdsp_midi_output_trigger':
>> sound/pci/rme9652/hdsp.c:1424:39: warning: increment of a boolean expression [-Wbool-operation]
1424 | hmidi->istimer++;
| ^~
>> sound/pci/rme9652/hdsp.c:1427:39: warning: decrement of a boolean expression [-Wbool-operation]
1427 | if (hmidi->istimer && --hmidi->istimer <= 0)
| ^~


vim +1424 sound/pci/rme9652/hdsp.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 1411
55e957d8328ef1 Takashi Iwai 2005-11-17 1412 static void snd_hdsp_midi_output_trigger(struct snd_rawmidi_substream *substream, int up)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1413 {
55e957d8328ef1 Takashi Iwai 2005-11-17 1414 struct hdsp_midi *hmidi;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1415 unsigned long flags;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1416
55e957d8328ef1 Takashi Iwai 2005-11-17 1417 hmidi = (struct hdsp_midi *) substream->rmidi->private_data;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1418 spin_lock_irqsave (&hmidi->lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1419 if (up) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1420 if (!hmidi->istimer) {
7211ec6392c865 Kees Cook 2017-10-25 1421 timer_setup(&hmidi->timer, snd_hdsp_midi_output_timer,
7211ec6392c865 Kees Cook 2017-10-25 1422 0);
c41c009ed5f0d2 Takashi Iwai 2015-01-19 1423 mod_timer(&hmidi->timer, 1 + jiffies);
^1da177e4c3f41 Linus Torvalds 2005-04-16 @1424 hmidi->istimer++;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1425 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1426 } else {
b0b9811956db48 Takashi Iwai 2005-10-20 @1427 if (hmidi->istimer && --hmidi->istimer <= 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1428 del_timer (&hmidi->timer);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1429 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1430 spin_unlock_irqrestore (&hmidi->lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1431 if (up)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1432 snd_hdsp_midi_output_write(hmidi);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1433 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1434

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (4.04 kB)
config (328.32 kB)
Download all attachments

2022-10-25 02:26:08

by Jason A. Donenfeld

[permalink] [raw]
Subject: [PATCH v2] ALSA: rme9652: use explicitly signed char

With char becoming unsigned by default, and with `char` alone being
ambiguous and based on architecture, signed chars need to be marked
explicitly as such. This fixes warnings like:

sound/pci/rme9652/hdsp.c:3953 hdsp_channel_buffer_location() warn: 'hdsp->channel_map[channel]' is unsigned
sound/pci/rme9652/hdsp.c:4153 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)'
sound/pci/rme9652/rme9652.c:1833 rme9652_channel_buffer_location() warn: 'rme9652->channel_map[channel]' is unsigned

Cc: Jaroslav Kysela <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: [email protected]
Signed-off-by: Jason A. Donenfeld <[email protected]>
---
sound/pci/rme9652/hdsp.c | 26 +++++++++++++-------------
sound/pci/rme9652/rme9652.c | 22 +++++++++++-----------
2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index dcc43a81ae0e..65add92c88aa 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -433,7 +433,7 @@ struct hdsp_midi {
struct snd_rawmidi *rmidi;
struct snd_rawmidi_substream *input;
struct snd_rawmidi_substream *output;
- char istimer; /* timer in use */
+ signed char istimer; /* timer in use */
struct timer_list timer;
spinlock_t lock;
int pending;
@@ -480,7 +480,7 @@ struct hdsp {
pid_t playback_pid;
int running;
int system_sample_rate;
- const char *channel_map;
+ const signed char *channel_map;
int dev;
int irq;
unsigned long port;
@@ -502,7 +502,7 @@ struct hdsp {
where the data for that channel can be read/written from/to.
*/

-static const char channel_map_df_ss[HDSP_MAX_CHANNELS] = {
+static const signed char channel_map_df_ss[HDSP_MAX_CHANNELS] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25
};
@@ -517,7 +517,7 @@ static const char channel_map_mf_ss[HDSP_MAX_CHANNELS] = { /* Multiface */
-1, -1, -1, -1, -1, -1, -1, -1
};

-static const char channel_map_ds[HDSP_MAX_CHANNELS] = {
+static const signed char channel_map_ds[HDSP_MAX_CHANNELS] = {
/* ADAT channels are remapped */
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23,
/* channels 12 and 13 are S/PDIF */
@@ -526,7 +526,7 @@ static const char channel_map_ds[HDSP_MAX_CHANNELS] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};

-static const char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = {
+static const signed char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = {
/* ADAT channels */
0, 1, 2, 3, 4, 5, 6, 7,
/* SPDIF */
@@ -540,7 +540,7 @@ static const char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = {
-1, -1
};

-static const char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = {
+static const signed char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = {
/* ADAT */
1, 3, 5, 7,
/* SPDIF */
@@ -554,7 +554,7 @@ static const char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = {
-1, -1, -1, -1, -1, -1
};

-static const char channel_map_H9632_qs[HDSP_MAX_CHANNELS] = {
+static const signed char channel_map_H9632_qs[HDSP_MAX_CHANNELS] = {
/* ADAT is disabled in this mode */
/* SPDIF */
8, 9,
@@ -3939,7 +3939,7 @@ static snd_pcm_uframes_t snd_hdsp_hw_pointer(struct snd_pcm_substream *substream
return hdsp_hw_pointer(hdsp);
}

-static char *hdsp_channel_buffer_location(struct hdsp *hdsp,
+static signed char *hdsp_channel_buffer_location(struct hdsp *hdsp,
int stream,
int channel)

@@ -3964,7 +3964,7 @@ static int snd_hdsp_playback_copy(struct snd_pcm_substream *substream,
void __user *src, unsigned long count)
{
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

if (snd_BUG_ON(pos + count > HDSP_CHANNEL_BUFFER_BYTES))
return -EINVAL;
@@ -3982,7 +3982,7 @@ static int snd_hdsp_playback_copy_kernel(struct snd_pcm_substream *substream,
void *src, unsigned long count)
{
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

channel_buf = hdsp_channel_buffer_location(hdsp, substream->pstr->stream, channel);
if (snd_BUG_ON(!channel_buf))
@@ -3996,7 +3996,7 @@ static int snd_hdsp_capture_copy(struct snd_pcm_substream *substream,
void __user *dst, unsigned long count)
{
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

if (snd_BUG_ON(pos + count > HDSP_CHANNEL_BUFFER_BYTES))
return -EINVAL;
@@ -4014,7 +4014,7 @@ static int snd_hdsp_capture_copy_kernel(struct snd_pcm_substream *substream,
void *dst, unsigned long count)
{
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

channel_buf = hdsp_channel_buffer_location(hdsp, substream->pstr->stream, channel);
if (snd_BUG_ON(!channel_buf))
@@ -4028,7 +4028,7 @@ static int snd_hdsp_hw_silence(struct snd_pcm_substream *substream,
unsigned long count)
{
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel);
if (snd_BUG_ON(!channel_buf))
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index 1d614fe89a6a..e7c320afefe8 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -230,7 +230,7 @@ struct snd_rme9652 {
int last_spdif_sample_rate; /* so that we can catch externally ... */
int last_adat_sample_rate; /* ... induced rate changes */

- const char *channel_map;
+ const signed char *channel_map;

struct snd_card *card;
struct snd_pcm *pcm;
@@ -247,12 +247,12 @@ struct snd_rme9652 {
where the data for that channel can be read/written from/to.
*/

-static const char channel_map_9652_ss[26] = {
+static const signed char channel_map_9652_ss[26] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25
};

-static const char channel_map_9636_ss[26] = {
+static const signed char channel_map_9636_ss[26] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
/* channels 16 and 17 are S/PDIF */
24, 25,
@@ -260,7 +260,7 @@ static const char channel_map_9636_ss[26] = {
-1, -1, -1, -1, -1, -1, -1, -1
};

-static const char channel_map_9652_ds[26] = {
+static const signed char channel_map_9652_ds[26] = {
/* ADAT channels are remapped */
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23,
/* channels 12 and 13 are S/PDIF */
@@ -269,7 +269,7 @@ static const char channel_map_9652_ds[26] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};

-static const char channel_map_9636_ds[26] = {
+static const signed char channel_map_9636_ds[26] = {
/* ADAT channels are remapped */
1, 3, 5, 7, 9, 11, 13, 15,
/* channels 8 and 9 are S/PDIF */
@@ -1819,7 +1819,7 @@ static snd_pcm_uframes_t snd_rme9652_hw_pointer(struct snd_pcm_substream *substr
return rme9652_hw_pointer(rme9652);
}

-static char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652,
+static signed char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652,
int stream,
int channel)

@@ -1847,7 +1847,7 @@ static int snd_rme9652_playback_copy(struct snd_pcm_substream *substream,
void __user *src, unsigned long count)
{
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES))
return -EINVAL;
@@ -1867,7 +1867,7 @@ static int snd_rme9652_playback_copy_kernel(struct snd_pcm_substream *substream,
void *src, unsigned long count)
{
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

channel_buf = rme9652_channel_buffer_location(rme9652,
substream->pstr->stream,
@@ -1883,7 +1883,7 @@ static int snd_rme9652_capture_copy(struct snd_pcm_substream *substream,
void __user *dst, unsigned long count)
{
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES))
return -EINVAL;
@@ -1903,7 +1903,7 @@ static int snd_rme9652_capture_copy_kernel(struct snd_pcm_substream *substream,
void *dst, unsigned long count)
{
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

channel_buf = rme9652_channel_buffer_location(rme9652,
substream->pstr->stream,
@@ -1919,7 +1919,7 @@ static int snd_rme9652_hw_silence(struct snd_pcm_substream *substream,
unsigned long count)
{
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
- char *channel_buf;
+ signed char *channel_buf;

channel_buf = rme9652_channel_buffer_location (rme9652,
substream->pstr->stream,
--
2.38.1

2022-10-25 07:07:22

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v2] ALSA: rme9652: use explicitly signed char

On Tue, 25 Oct 2022 02:03:13 +0200,
Jason A. Donenfeld wrote:
>
> With char becoming unsigned by default, and with `char` alone being
> ambiguous and based on architecture, signed chars need to be marked
> explicitly as such. This fixes warnings like:
>
> sound/pci/rme9652/hdsp.c:3953 hdsp_channel_buffer_location() warn: 'hdsp->channel_map[channel]' is unsigned
> sound/pci/rme9652/hdsp.c:4153 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)'
> sound/pci/rme9652/rme9652.c:1833 rme9652_channel_buffer_location() warn: 'rme9652->channel_map[channel]' is unsigned
>
> Cc: Jaroslav Kysela <[email protected]>
> Cc: Takashi Iwai <[email protected]>
> Cc: [email protected]
> Signed-off-by: Jason A. Donenfeld <[email protected]>

Applied now. Thanks!


Takashi

2022-10-25 12:15:24

by Jason A. Donenfeld

[permalink] [raw]
Subject: Re: [PATCH v2] ALSA: rme9652: use explicitly signed char

On Tue, Oct 25, 2022 at 08:21:55AM +0200, Takashi Iwai wrote:
> On Tue, 25 Oct 2022 02:03:13 +0200,
> Jason A. Donenfeld wrote:
> >
> > With char becoming unsigned by default, and with `char` alone being
> > ambiguous and based on architecture, signed chars need to be marked
> > explicitly as such. This fixes warnings like:
> >
> > sound/pci/rme9652/hdsp.c:3953 hdsp_channel_buffer_location() warn: 'hdsp->channel_map[channel]' is unsigned
> > sound/pci/rme9652/hdsp.c:4153 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)'
> > sound/pci/rme9652/rme9652.c:1833 rme9652_channel_buffer_location() warn: 'rme9652->channel_map[channel]' is unsigned
> >
> > Cc: Jaroslav Kysela <[email protected]>
> > Cc: Takashi Iwai <[email protected]>
> > Cc: [email protected]
> > Signed-off-by: Jason A. Donenfeld <[email protected]>
>
> Applied now. Thanks!

Thanks. For this and the other patch, applied for 6.1 or 6.2?

Jason

2022-10-25 13:10:29

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v2] ALSA: rme9652: use explicitly signed char

On Tue, 25 Oct 2022 14:08:29 +0200,
Jason A. Donenfeld wrote:
>
> On Tue, Oct 25, 2022 at 08:21:55AM +0200, Takashi Iwai wrote:
> > On Tue, 25 Oct 2022 02:03:13 +0200,
> > Jason A. Donenfeld wrote:
> > >
> > > With char becoming unsigned by default, and with `char` alone being
> > > ambiguous and based on architecture, signed chars need to be marked
> > > explicitly as such. This fixes warnings like:
> > >
> > > sound/pci/rme9652/hdsp.c:3953 hdsp_channel_buffer_location() warn: 'hdsp->channel_map[channel]' is unsigned
> > > sound/pci/rme9652/hdsp.c:4153 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)'
> > > sound/pci/rme9652/rme9652.c:1833 rme9652_channel_buffer_location() warn: 'rme9652->channel_map[channel]' is unsigned
> > >
> > > Cc: Jaroslav Kysela <[email protected]>
> > > Cc: Takashi Iwai <[email protected]>
> > > Cc: [email protected]
> > > Signed-off-by: Jason A. Donenfeld <[email protected]>
> >
> > Applied now. Thanks!
>
> Thanks. For this and the other patch, applied for 6.1 or 6.2?

I applied for 6.2. Was it an action that has to be fixed for 6.1?
If so, I still can shuffle.


thanks,

Takashi

2022-10-25 13:49:55

by Jason A. Donenfeld

[permalink] [raw]
Subject: Re: [PATCH v2] ALSA: rme9652: use explicitly signed char

On Tue, Oct 25, 2022 at 3:14 PM Takashi Iwai <[email protected]> wrote:
>
> On Tue, 25 Oct 2022 15:11:39 +0200,
> Takashi Iwai wrote:
> >
> > On Tue, 25 Oct 2022 14:54:54 +0200,
> > Jason A. Donenfeld wrote:
> > >
> > > On Tue, Oct 25, 2022 at 2:48 PM Takashi Iwai <[email protected]> wrote:
> > > >
> > > > On Tue, 25 Oct 2022 14:08:29 +0200,
> > > > Jason A. Donenfeld wrote:
> > > > >
> > > > > On Tue, Oct 25, 2022 at 08:21:55AM +0200, Takashi Iwai wrote:
> > > > > > On Tue, 25 Oct 2022 02:03:13 +0200,
> > > > > > Jason A. Donenfeld wrote:
> > > > > > >
> > > > > > > With char becoming unsigned by default, and with `char` alone being
> > > > > > > ambiguous and based on architecture, signed chars need to be marked
> > > > > > > explicitly as such. This fixes warnings like:
> > > > > > >
> > > > > > > sound/pci/rme9652/hdsp.c:3953 hdsp_channel_buffer_location() warn: 'hdsp->channel_map[channel]' is unsigned
> > > > > > > sound/pci/rme9652/hdsp.c:4153 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)'
> > > > > > > sound/pci/rme9652/rme9652.c:1833 rme9652_channel_buffer_location() warn: 'rme9652->channel_map[channel]' is unsigned
> > > > > > >
> > > > > > > Cc: Jaroslav Kysela <[email protected]>
> > > > > > > Cc: Takashi Iwai <[email protected]>
> > > > > > > Cc: [email protected]
> > > > > > > Signed-off-by: Jason A. Donenfeld <[email protected]>
> > > > > >
> > > > > > Applied now. Thanks!
> > > > >
> > > > > Thanks. For this and the other patch, applied for 6.1 or 6.2?
> > > >
> > > > I applied for 6.2. Was it an action that has to be fixed for 6.1?
> > > > If so, I still can shuffle.
> > >
> > > Well, this is code that's broken currently on ARM platforms, for
> > > example, where char is already unsigned. So it's arguably a fix for
> > > 6.1.
> >
> > Fair enough, I'll apply for 6.1, then.
>
> ... and in that case, it deserves for Cc-to-stable, IMO, as it's a fix
> to be done for older kernels, too. Then it'd be clearly a 6.1
> material.

Fine by me if you want to add that (for this and the other patch).

2022-10-25 13:49:56

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v2] ALSA: rme9652: use explicitly signed char

On Tue, 25 Oct 2022 15:11:39 +0200,
Takashi Iwai wrote:
>
> On Tue, 25 Oct 2022 14:54:54 +0200,
> Jason A. Donenfeld wrote:
> >
> > On Tue, Oct 25, 2022 at 2:48 PM Takashi Iwai <[email protected]> wrote:
> > >
> > > On Tue, 25 Oct 2022 14:08:29 +0200,
> > > Jason A. Donenfeld wrote:
> > > >
> > > > On Tue, Oct 25, 2022 at 08:21:55AM +0200, Takashi Iwai wrote:
> > > > > On Tue, 25 Oct 2022 02:03:13 +0200,
> > > > > Jason A. Donenfeld wrote:
> > > > > >
> > > > > > With char becoming unsigned by default, and with `char` alone being
> > > > > > ambiguous and based on architecture, signed chars need to be marked
> > > > > > explicitly as such. This fixes warnings like:
> > > > > >
> > > > > > sound/pci/rme9652/hdsp.c:3953 hdsp_channel_buffer_location() warn: 'hdsp->channel_map[channel]' is unsigned
> > > > > > sound/pci/rme9652/hdsp.c:4153 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)'
> > > > > > sound/pci/rme9652/rme9652.c:1833 rme9652_channel_buffer_location() warn: 'rme9652->channel_map[channel]' is unsigned
> > > > > >
> > > > > > Cc: Jaroslav Kysela <[email protected]>
> > > > > > Cc: Takashi Iwai <[email protected]>
> > > > > > Cc: [email protected]
> > > > > > Signed-off-by: Jason A. Donenfeld <[email protected]>
> > > > >
> > > > > Applied now. Thanks!
> > > >
> > > > Thanks. For this and the other patch, applied for 6.1 or 6.2?
> > >
> > > I applied for 6.2. Was it an action that has to be fixed for 6.1?
> > > If so, I still can shuffle.
> >
> > Well, this is code that's broken currently on ARM platforms, for
> > example, where char is already unsigned. So it's arguably a fix for
> > 6.1.
>
> Fair enough, I'll apply for 6.1, then.

... and in that case, it deserves for Cc-to-stable, IMO, as it's a fix
to be done for older kernels, too. Then it'd be clearly a 6.1
material.


Takashi

2022-10-25 13:53:52

by Jason A. Donenfeld

[permalink] [raw]
Subject: Re: [PATCH v2] ALSA: rme9652: use explicitly signed char

On Tue, Oct 25, 2022 at 2:48 PM Takashi Iwai <[email protected]> wrote:
>
> On Tue, 25 Oct 2022 14:08:29 +0200,
> Jason A. Donenfeld wrote:
> >
> > On Tue, Oct 25, 2022 at 08:21:55AM +0200, Takashi Iwai wrote:
> > > On Tue, 25 Oct 2022 02:03:13 +0200,
> > > Jason A. Donenfeld wrote:
> > > >
> > > > With char becoming unsigned by default, and with `char` alone being
> > > > ambiguous and based on architecture, signed chars need to be marked
> > > > explicitly as such. This fixes warnings like:
> > > >
> > > > sound/pci/rme9652/hdsp.c:3953 hdsp_channel_buffer_location() warn: 'hdsp->channel_map[channel]' is unsigned
> > > > sound/pci/rme9652/hdsp.c:4153 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)'
> > > > sound/pci/rme9652/rme9652.c:1833 rme9652_channel_buffer_location() warn: 'rme9652->channel_map[channel]' is unsigned
> > > >
> > > > Cc: Jaroslav Kysela <[email protected]>
> > > > Cc: Takashi Iwai <[email protected]>
> > > > Cc: [email protected]
> > > > Signed-off-by: Jason A. Donenfeld <[email protected]>
> > >
> > > Applied now. Thanks!
> >
> > Thanks. For this and the other patch, applied for 6.1 or 6.2?
>
> I applied for 6.2. Was it an action that has to be fixed for 6.1?
> If so, I still can shuffle.

Well, this is code that's broken currently on ARM platforms, for
example, where char is already unsigned. So it's arguably a fix for
6.1.

(And if you're in fact not going to take it for 6.1, I'm supposed to
take it through my unsigned-char tree for 6.2.)

Jason

2022-10-25 13:55:33

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v2] ALSA: rme9652: use explicitly signed char

On Tue, 25 Oct 2022 15:14:54 +0200,
Jason A. Donenfeld wrote:
>
> On Tue, Oct 25, 2022 at 3:14 PM Takashi Iwai <[email protected]> wrote:
> >
> > On Tue, 25 Oct 2022 15:11:39 +0200,
> > Takashi Iwai wrote:
> > >
> > > On Tue, 25 Oct 2022 14:54:54 +0200,
> > > Jason A. Donenfeld wrote:
> > > >
> > > > On Tue, Oct 25, 2022 at 2:48 PM Takashi Iwai <[email protected]> wrote:
> > > > >
> > > > > On Tue, 25 Oct 2022 14:08:29 +0200,
> > > > > Jason A. Donenfeld wrote:
> > > > > >
> > > > > > On Tue, Oct 25, 2022 at 08:21:55AM +0200, Takashi Iwai wrote:
> > > > > > > On Tue, 25 Oct 2022 02:03:13 +0200,
> > > > > > > Jason A. Donenfeld wrote:
> > > > > > > >
> > > > > > > > With char becoming unsigned by default, and with `char` alone being
> > > > > > > > ambiguous and based on architecture, signed chars need to be marked
> > > > > > > > explicitly as such. This fixes warnings like:
> > > > > > > >
> > > > > > > > sound/pci/rme9652/hdsp.c:3953 hdsp_channel_buffer_location() warn: 'hdsp->channel_map[channel]' is unsigned
> > > > > > > > sound/pci/rme9652/hdsp.c:4153 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)'
> > > > > > > > sound/pci/rme9652/rme9652.c:1833 rme9652_channel_buffer_location() warn: 'rme9652->channel_map[channel]' is unsigned
> > > > > > > >
> > > > > > > > Cc: Jaroslav Kysela <[email protected]>
> > > > > > > > Cc: Takashi Iwai <[email protected]>
> > > > > > > > Cc: [email protected]
> > > > > > > > Signed-off-by: Jason A. Donenfeld <[email protected]>
> > > > > > >
> > > > > > > Applied now. Thanks!
> > > > > >
> > > > > > Thanks. For this and the other patch, applied for 6.1 or 6.2?
> > > > >
> > > > > I applied for 6.2. Was it an action that has to be fixed for 6.1?
> > > > > If so, I still can shuffle.
> > > >
> > > > Well, this is code that's broken currently on ARM platforms, for
> > > > example, where char is already unsigned. So it's arguably a fix for
> > > > 6.1.
> > >
> > > Fair enough, I'll apply for 6.1, then.
> >
> > ... and in that case, it deserves for Cc-to-stable, IMO, as it's a fix
> > to be done for older kernels, too. Then it'd be clearly a 6.1
> > material.
>
> Fine by me if you want to add that (for this and the other patch).

OK, done.


Takashi

2022-10-25 14:23:10

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v2] ALSA: rme9652: use explicitly signed char

On Tue, 25 Oct 2022 14:54:54 +0200,
Jason A. Donenfeld wrote:
>
> On Tue, Oct 25, 2022 at 2:48 PM Takashi Iwai <[email protected]> wrote:
> >
> > On Tue, 25 Oct 2022 14:08:29 +0200,
> > Jason A. Donenfeld wrote:
> > >
> > > On Tue, Oct 25, 2022 at 08:21:55AM +0200, Takashi Iwai wrote:
> > > > On Tue, 25 Oct 2022 02:03:13 +0200,
> > > > Jason A. Donenfeld wrote:
> > > > >
> > > > > With char becoming unsigned by default, and with `char` alone being
> > > > > ambiguous and based on architecture, signed chars need to be marked
> > > > > explicitly as such. This fixes warnings like:
> > > > >
> > > > > sound/pci/rme9652/hdsp.c:3953 hdsp_channel_buffer_location() warn: 'hdsp->channel_map[channel]' is unsigned
> > > > > sound/pci/rme9652/hdsp.c:4153 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)'
> > > > > sound/pci/rme9652/rme9652.c:1833 rme9652_channel_buffer_location() warn: 'rme9652->channel_map[channel]' is unsigned
> > > > >
> > > > > Cc: Jaroslav Kysela <[email protected]>
> > > > > Cc: Takashi Iwai <[email protected]>
> > > > > Cc: [email protected]
> > > > > Signed-off-by: Jason A. Donenfeld <[email protected]>
> > > >
> > > > Applied now. Thanks!
> > >
> > > Thanks. For this and the other patch, applied for 6.1 or 6.2?
> >
> > I applied for 6.2. Was it an action that has to be fixed for 6.1?
> > If so, I still can shuffle.
>
> Well, this is code that's broken currently on ARM platforms, for
> example, where char is already unsigned. So it's arguably a fix for
> 6.1.

Fair enough, I'll apply for 6.1, then.


Takashi