aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--alsa-pcm.c3
-rw-r--r--utils.h23
2 files changed, 9 insertions, 17 deletions
diff --git a/alsa-pcm.c b/alsa-pcm.c
index 0c39a4d..f174ef0 100644
--- a/alsa-pcm.c
+++ b/alsa-pcm.c
@@ -55,8 +55,7 @@ static int pcm_open(struct snd_pcm_substream *substream)
stream = __avirt_stream_find_by_device(substream->pcm->device);
audiopath = avirt_audiopath_get(stream->map);
- CHK_NULL_V(audiopath, -EFAULT, "Cannot find Audio Path uid: '%s'!",
- stream->map);
+ CHK_NULL_V(audiopath, "Cannot find Audio Path uid: '%s'!", stream->map);
substream->private_data = audiopath;
// Copy the hw params from the audiopath to the pcm
diff --git a/utils.h b/utils.h
index 844ee55..0931e82 100644
--- a/utils.h
+++ b/utils.h
@@ -10,39 +10,32 @@
#ifndef __SOUND_AVIRT_UTILS_H
#define __SOUND_AVIRT_UTILS_H
-#include <linux/slab.h>
-
-#define PRINT_ERR(errno, errmsg) \
- pr_err("[%s]:[ERRNO:%d]: %s \n", __func__, errno, (errmsg));
-
#define CHK_ERR(errno) \
do { \
if ((errno) < 0) \
return (errno); \
} while (0)
-#define CHK_ERR_V(errno, errmsg, ...) \
+#define CHK_ERR_V(errno, fmt, args...) \
do { \
if ((errno) < 0) { \
- PRINT_ERR((errno), (errmsg), ##__VA_ARGS__) \
+ DERROR(D_LOGNAME, (fmt), ##args) \
return (errno); \
} \
} while (0)
-#define CHK_NULL(x, errno) \
+#define CHK_NULL(x) \
do { \
if (!(x)) \
- return errno; \
+ return -EFAULT; \
} while (0)
-#define CHK_NULL_V(x, errno, errmsg, ...) \
+#define CHK_NULL_V(x, fmt, args...) \
do { \
if (!(x)) { \
- char *errmsg_done = \
- kasprintf(GFP_KERNEL, errmsg, ##__VA_ARGS__); \
- PRINT_ERR(EFAULT, errmsg_done); \
- kfree(errmsg_done); \
- return errno; \
+ DERROR(D_LOGNAME, "[ERRNO: %d] " fmt, -EFAULT, \
+ ##args); \
+ return -EFAULT; \
} \
} while (0)