ALSA: core: Drop superfluous no_free_ptr() for memdup_user() errors
authorTakashi Iwai <tiwai@suse.de>
Mon, 2 Sep 2024 07:52:27 +0000 (09:52 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 2 Sep 2024 08:21:41 +0000 (10:21 +0200)
We used to wrap with no_free_ptr() for the return value from
memdup_user() with errors where the auto cleanup is applied.  This was
a workaround because the initial implementation of kfree auto-cleanup
checked only NULL pointers.

Since recently, though, the kfree auto-cleanup checks with
IS_ERR_OR_NULL() (by the commit cd7eb8f83fcf ("mm/slab: make
__free(kfree) accept error pointers")), hence those workarounds became
superfluous.  Let's drop them now.

Link: https://patch.msgid.link/20240902075246.3743-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/compress_offload.c
sound/core/control.c
sound/core/pcm_native.c
sound/core/timer.c

index f0008fa2d8396c8e898829a41360dc11eed19b1d..b8c0d6edbdd187e0b4114af824b01568cd398b26 100644 (file)
@@ -581,7 +581,7 @@ snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
                 */
                params = memdup_user((void __user *)arg, sizeof(*params));
                if (IS_ERR(params))
-                       return PTR_ERR(no_free_ptr(params));
+                       return PTR_ERR(params);
 
                retval = snd_compress_check_input(params);
                if (retval)
index 7d7d592a8428006f0a3ef73ef0f25b7b62c31788..4f55f64c42e117ae620807da593cac1f991f8dec 100644 (file)
@@ -1249,7 +1249,7 @@ static int snd_ctl_elem_read_user(struct snd_card *card,
 
        control = memdup_user(_control, sizeof(*control));
        if (IS_ERR(control))
-               return PTR_ERR(no_free_ptr(control));
+               return PTR_ERR(control);
 
        result = snd_power_ref_and_wait(card);
        if (result)
@@ -1326,7 +1326,7 @@ static int snd_ctl_elem_write_user(struct snd_ctl_file *file,
 
        control = memdup_user(_control, sizeof(*control));
        if (IS_ERR(control))
-               return PTR_ERR(no_free_ptr(control));
+               return PTR_ERR(control);
 
        card = file->card;
        result = snd_power_ref_and_wait(card);
index 4057f9f10aeec250ae9b50f168f2c096f6c77e71..44381514f695b0411c17f2d2297690e372ccb53e 100644 (file)
@@ -582,7 +582,7 @@ static int snd_pcm_hw_refine_user(struct snd_pcm_substream *substream,
 
        params = memdup_user(_params, sizeof(*params));
        if (IS_ERR(params))
-               return PTR_ERR(no_free_ptr(params));
+               return PTR_ERR(params);
 
        err = snd_pcm_hw_refine(substream, params);
        if (err < 0)
@@ -872,7 +872,7 @@ static int snd_pcm_hw_params_user(struct snd_pcm_substream *substream,
 
        params = memdup_user(_params, sizeof(*params));
        if (IS_ERR(params))
-               return PTR_ERR(no_free_ptr(params));
+               return PTR_ERR(params);
 
        err = snd_pcm_hw_params(substream, params);
        if (err < 0)
@@ -3243,7 +3243,7 @@ static int snd_pcm_xfern_frames_ioctl(struct snd_pcm_substream *substream,
 
        bufs = memdup_user(xfern.bufs, sizeof(void *) * runtime->channels);
        if (IS_ERR(bufs))
-               return PTR_ERR(no_free_ptr(bufs));
+               return PTR_ERR(bufs);
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
                result = snd_pcm_lib_writev(substream, bufs, xfern.frames);
        else
@@ -4032,7 +4032,7 @@ static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream,
 
        oparams = memdup_user(_oparams, sizeof(*oparams));
        if (IS_ERR(oparams))
-               return PTR_ERR(no_free_ptr(oparams));
+               return PTR_ERR(oparams);
        snd_pcm_hw_convert_from_old_params(params, oparams);
        err = snd_pcm_hw_refine(substream, params);
        if (err < 0)
@@ -4061,7 +4061,7 @@ static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream,
 
        oparams = memdup_user(_oparams, sizeof(*oparams));
        if (IS_ERR(oparams))
-               return PTR_ERR(no_free_ptr(oparams));
+               return PTR_ERR(oparams);
 
        snd_pcm_hw_convert_from_old_params(params, oparams);
        err = snd_pcm_hw_params(substream, params);
index 4315d1e98ebfb8560b71e49c16ec1ceb919c0fba..668c40bac318d37bb973e858bbff02d643d829e8 100644 (file)
@@ -1615,7 +1615,7 @@ static int snd_timer_user_ginfo(struct file *file,
 
        ginfo = memdup_user(_ginfo, sizeof(*ginfo));
        if (IS_ERR(ginfo))
-               return PTR_ERR(no_free_ptr(ginfo));
+               return PTR_ERR(ginfo);
 
        tid = ginfo->tid;
        memset(ginfo, 0, sizeof(*ginfo));
@@ -2190,7 +2190,7 @@ static int snd_utimer_ioctl_create(struct file *file,
 
        utimer_info = memdup_user(_utimer_info, sizeof(*utimer_info));
        if (IS_ERR(utimer_info))
-               return PTR_ERR(no_free_ptr(utimer_info));
+               return PTR_ERR(utimer_info);
 
        err = snd_utimer_create(utimer_info, &utimer);
        if (err < 0)