Skip to contentSkip to conversation

uapi: fix linux/usb/audio.h userspace compilation error

PATCH In review Dmitry V. Levin 2 participants 4 messages Aug 13, 2018 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uapi: fix linux/usb/audio.h userspace compilation error

Replace NULL with 0 in uac_mixer_unit_bmControls() to fix the following linux/usb/audio.h userspace compilation error:

/usr/include/linux/usb/audio.h: In function 'uac_mixer_unit_bmControls':
/usr/include/linux/usb/audio.h:304:10: error: 'NULL' undeclared (first use in this function)
return NULL;

Fixes 6cfd839ae78e ("ALSA: usb-audio: UAC3. Add support for mixer unit.")
Cc <[email protected]> # v4.18
---
 include/uapi/linux/usb/audio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/usb/audio.h +1 -1
index 74e520fb944f..2b61fe34b2ca 100644
@@ -301,7 +301,7 @@ static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *
 	case UAC_VERSION_3:
 		return &desc->baSourceID[desc->bNrInPins + 2];
 	default:
-		return NULL;
+		return 0;
 	}
 }
 
Signature · 1 line
ldv
#1 lore raw
Quoted 11 lines · Dmitry V. Levin

Replace NULL with 0 in uac_mixer_unit_bmControls() to fix the following linux/usb/audio.h userspace compilation error:

/usr/include/linux/usb/audio.h: In function 'uac_mixer_unit_bmControls':
/usr/include/linux/usb/audio.h:304:10: error: 'NULL' undeclared (first use in this function)
return NULL;

Fixes 6cfd839ae78e ("ALSA: usb-audio: UAC3. Add support for mixer unit.")
Cc <[email protected]> # v4.18

Hrm, can we include the standard header for definition of NULL instead? It's way too ugly to use 0 just for that.

thanks,

Takashi

Quoted 20 lines
---
 include/uapi/linux/usb/audio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/usb/audio.h +1 -1
index 74e520fb944f..2b61fe34b2ca 100644
@@ -301,7 +301,7 @@ static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *
 	case UAC_VERSION_3:
 		return &desc->baSourceID[desc->bNrInPins + 2];
 	default:
-		return NULL;
+		return 0;
 	}
 }
 
Signature · 1 line
ldv
#2 lore raw
Quoted 9 lines · Takashi Iwai
Quoted 8 lines · Dmitry V. Levin

Replace NULL with 0 in uac_mixer_unit_bmControls() to fix the following linux/usb/audio.h userspace compilation error:

/usr/include/linux/usb/audio.h: In function 'uac_mixer_unit_bmControls':
/usr/include/linux/usb/audio.h:304:10: error: 'NULL' undeclared (first use in this function)
return NULL;

Quoted 6 lines
Quoted 3 lines
Fixes 6cfd839ae78e ("ALSA: usb-audio: UAC3. Add support for mixer unit.")
Cc <[email protected]> # v4.18

Hrm, can we include the standard header for definition of NULL instead? It's way too ugly to use 0 just for that.

It's fine to return 0 as a null pointer. If you prefer NULL, please include a header that won't break userspace, or just move the function out of UAPI.

Thanks,

Signature · 1 line
ldv
#3 lore raw
Quoted 11 lines · Dmitry V. Levin
Quoted 9 lines · Takashi Iwai
Quoted 8 lines · Dmitry V. Levin

Replace NULL with 0 in uac_mixer_unit_bmControls() to fix the following linux/usb/audio.h userspace compilation error:

/usr/include/linux/usb/audio.h: In function 'uac_mixer_unit_bmControls':
/usr/include/linux/usb/audio.h:304:10: error: 'NULL' undeclared (first use in this function)
return NULL;

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Fixes 6cfd839ae78e ("ALSA: usb-audio: UAC3. Add support for mixer unit.")
Cc <[email protected]> # v4.18

Hrm, can we include the standard header for definition of NULL instead? It's way too ugly to use 0 just for that.

It's fine to return 0 as a null pointer.

Fine from syntax POV, but not from semantic.

Quoted 3 lines

If you prefer NULL,
please include a header that won't break userspace, or just move the function out of UAPI.

Maybe better to remove the function from uapi, then.

Takashi