From nobody Thu Apr 2 16:58:53 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96F0233F385; Fri, 27 Mar 2026 10:52:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774608740; cv=none; b=gQ88tW1i/LRCnwi49CIsG1HuQd5+JndJZX3fTqX87pPp5JHujq1+OAgL+D3FC3BMdsUOsq1DiDInxYWRqPLNcTdGPakJCVQiFntb2EUnbl6z4Qz8vYB2Htd2dIV32kvns5WOdCztHHMuZkUYkeRve7mEPR7YuYutQWc87Bbe9sU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774608740; c=relaxed/simple; bh=PIjhqXV96eZdpEdqYKATLZ86ccJJiq7XCV261VUyjdg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GFNG8v281TZSwtP07ScUvqIXyQMNtf7VuPd4aF1fzFkPs83NSmLJ0JWm+hVZELLDm8VBmsnvE4Lds4Q3uih/59qM8i/1sTkssNi4jahM5re0XQgaxvhYiIY9G/BCBdGJSRvkFTLNxiOSXww1pymnCNkxOsdvar2dYrow4lf+rlM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HSoU9hMt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HSoU9hMt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FE41C2BC86; Fri, 27 Mar 2026 10:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774608740; bh=PIjhqXV96eZdpEdqYKATLZ86ccJJiq7XCV261VUyjdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSoU9hMtl1mpvyS+eR6AvXOwZ/ntnp6B3E7TT74fiScs0MJHSKFQC8EmBkr6pWYDZ dHnED8ne9UwQeZVPu7TyMbzhkrHT20UxQBaTyY61YHE2DBSHOQzs7BlbeHr4LRXcbD codAwSjme9EYZ5DYnVUBGTO4rf3rul3Nzfnz0ilr8++pr6JiicfRk37eiyim+I7m+d XfG8FftrC8brcEoLelHr1jsJTwwc/BsQY72T15AYkA5awIFzS8SZS36/Z2V+WCzxjg k0oBRzmytmBC2kt/bIk+lkc/yqwLwWSDpU6VYL21Bf4h6JDVxfmkXu+Qn598qTEwlJ 5N9NB013H/gXQ== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1w64na-00000005UzU-14MI; Fri, 27 Mar 2026 11:52:18 +0100 From: Johan Hovold To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Tony Olech Subject: [PATCH 1/4] mmc: vub300: fix NULL-deref on disconnect Date: Fri, 27 Mar 2026 11:52:05 +0100 Message-ID: <20260327105208.1310739-2-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260327105208.1310739-1-johan@kernel.org> References: <20260327105208.1310739-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make sure to deregister the controller before dropping the reference to the driver data on disconnect to avoid NULL-pointer dereferences or use-after-free. Fixes: 88095e7b473a ("mmc: Add new VUB300 USB-to-SD/SDIO/MMC driver") Cc: stable@vger.kernel.org # 3.0 Cc: Tony Olech Signed-off-by: Johan Hovold --- drivers/mmc/host/vub300.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c index ff49d0770506..f173c7cf4e1a 100644 --- a/drivers/mmc/host/vub300.c +++ b/drivers/mmc/host/vub300.c @@ -2365,8 +2365,8 @@ static void vub300_disconnect(struct usb_interface *i= nterface) usb_set_intfdata(interface, NULL); /* prevent more I/O from starting */ vub300->interface =3D NULL; - kref_put(&vub300->kref, vub300_delete); mmc_remove_host(mmc); + kref_put(&vub300->kref, vub300_delete); pr_info("USB vub300 remote SDIO host controller[%d]" " now disconnected", ifnum); return; --=20 2.52.0 From nobody Thu Apr 2 16:58:53 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96D4E2D6E4B; Fri, 27 Mar 2026 10:52:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774608740; cv=none; b=kiBjSFEhJd0aFoDIRBchJshmfTS6DHVh+/OFJGhDwj1dVSSCMRUgFH8ofg/0D6rQME9vZqypj17E7q+OL0m+zGiJtqPlSauUrGASHwkbO2GyrcoiGnvoB0yKcmPIS1z+cZAtCMPAVa9Pvcqp7fAGTTnGOFp6m7ra6OtBjyp5Kew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774608740; c=relaxed/simple; bh=hZguq+lW6Mv0r3bUzKtQ4MnIraUe40XJWt/lVIf2SMg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MrS/KQZStP/9toCTolN7wkHaIQKJdYdr/KsiMoz7cRTTprmWLx6LkP9UvXPzaSkoqpP3qInXigdU+z83uYZdBmXePFlz+Rit4dE7AAz7apjJ/maM2g4k8MmEg7e9RgdCnOFACf+eBFd5XkSWvr8n+AmJqryrNWE8B8yk0fkZldU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=srcb3oS0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="srcb3oS0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6458BC2BCB2; Fri, 27 Mar 2026 10:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774608740; bh=hZguq+lW6Mv0r3bUzKtQ4MnIraUe40XJWt/lVIf2SMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=srcb3oS0Y2YWqiUl4Be8vlaWc4AX4yJQ8DyiQ7ke6yiWc1CTaZ8h2ebpMotDCyih8 XuOO6XiHn9N3wioHqWS31yBkNYds4upF5SBIOqXEZEBwlvTQ16/I8JrLfxxvFKfFnN 8wrz8r/ObZziD9Ytog/sCQEJbHSooNTS4X1pM3u+Z4nE5tp2NwjK5D7HXe9x6Jmu2r YVl4YqqLDkDN9kJ6/6mNzLACnjE3f2THQwCQjDRvs+gxG/g69WTgT0otzi5NpsxxVo 3441c7Zyh66BHiPGJu48xQV+ciNgUVrt+QVeXvEGm3lKEKeQxOa3pg4wnOw7YNDNqP Z9Ku50wXAud9g== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1w64na-00000005UzW-16hm; Fri, 27 Mar 2026 11:52:18 +0100 From: Johan Hovold To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Binbin Zhou Subject: [PATCH 2/4] mmc: vub300: fix use-after-free on disconnect Date: Fri, 27 Mar 2026 11:52:06 +0100 Message-ID: <20260327105208.1310739-3-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260327105208.1310739-1-johan@kernel.org> References: <20260327105208.1310739-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The vub300 driver maintains an explicit reference count for the controller and its driver data and the last reference can in theory be dropped after the driver has been unbound. This specifically means that the controller allocation must not be device managed as that can lead to use-after-free. Note that the lifetime is currently also incorrectly tied the parent USB device rather than interface, which can lead to memory leaks if the driver is unbound without its device being physically disconnected (e.g. on probe deferral). Fix both issues by reverting to non-managed allocation of the controller. Fixes: dcfdd698dc52 ("mmc: vub300: Use devm_mmc_alloc_host() helper") Cc: stable@vger.kernel.org # 6.17 Cc: Binbin Zhou Signed-off-by: Johan Hovold --- drivers/mmc/host/vub300.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c index f173c7cf4e1a..3c9df27f9fa7 100644 --- a/drivers/mmc/host/vub300.c +++ b/drivers/mmc/host/vub300.c @@ -369,11 +369,14 @@ struct vub300_mmc_host { static void vub300_delete(struct kref *kref) { /* kref callback - softirq */ struct vub300_mmc_host *vub300 =3D kref_to_vub300_mmc_host(kref); + struct mmc_host *mmc =3D vub300->mmc; + usb_free_urb(vub300->command_out_urb); vub300->command_out_urb =3D NULL; usb_free_urb(vub300->command_res_urb); vub300->command_res_urb =3D NULL; usb_put_dev(vub300->udev); + mmc_free_host(mmc); /* * and hence also frees vub300 * which is contained at the end of struct mmc @@ -2112,7 +2115,7 @@ static int vub300_probe(struct usb_interface *interfa= ce, goto error1; } /* this also allocates memory for our VUB300 mmc host device */ - mmc =3D devm_mmc_alloc_host(&udev->dev, sizeof(*vub300)); + mmc =3D mmc_alloc_host(sizeof(*vub300), &udev->dev); if (!mmc) { retval =3D -ENOMEM; dev_err(&udev->dev, "not enough memory for the mmc_host\n"); @@ -2269,7 +2272,7 @@ static int vub300_probe(struct usb_interface *interfa= ce, dev_err(&vub300->udev->dev, "Could not find two sets of bulk-in/out endpoint pairs\n"); retval =3D -EINVAL; - goto error4; + goto err_free_host; } retval =3D usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0), @@ -2278,14 +2281,14 @@ static int vub300_probe(struct usb_interface *inter= face, 0x0000, 0x0000, &vub300->hc_info, sizeof(vub300->hc_info), 1000); if (retval < 0) - goto error4; + goto err_free_host; retval =3D usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0), SET_ROM_WAIT_STATES, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, firmware_rom_wait_states, 0x0000, NULL, 0, 1000); if (retval < 0) - goto error4; + goto err_free_host; dev_info(&vub300->udev->dev, "operating_mode =3D %s %s %d MHz %s %d byte USB packets\n", (mmc->caps & MMC_CAP_SDIO_IRQ) ? "IRQs" : "POLL", @@ -2300,7 +2303,7 @@ static int vub300_probe(struct usb_interface *interfa= ce, 0x0000, 0x0000, &vub300->system_port_status, sizeof(vub300->system_port_status), 1000); if (retval < 0) { - goto error4; + goto err_free_host; } else if (sizeof(vub300->system_port_status) =3D=3D retval) { vub300->card_present =3D (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0; @@ -2308,7 +2311,7 @@ static int vub300_probe(struct usb_interface *interfa= ce, (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0; } else { retval =3D -EINVAL; - goto error4; + goto err_free_host; } usb_set_intfdata(interface, vub300); INIT_DELAYED_WORK(&vub300->pollwork, vub300_pollwork_thread); @@ -2338,6 +2341,8 @@ static int vub300_probe(struct usb_interface *interfa= ce, return 0; error6: timer_delete_sync(&vub300->inactivity_timer); +err_free_host: + mmc_free_host(mmc); /* * and hence also frees vub300 * which is contained at the end of struct mmc --=20 2.52.0 From nobody Thu Apr 2 16:58:53 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96E6033CEB5; Fri, 27 Mar 2026 10:52:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774608740; cv=none; b=NaexBMwvhGerbhmQU0+Z0Tz7+UyzLcxHUt149EqYQC6WJL4emf7nrVHtK+g9KsX5z9IcptYVuGb/diPEvXhhplk4LboZVMwrqfKi3OsqGyRiAToyJul7nshlohNuw2qsVwbv5SHztXqDBmlJlZ7p6L2K3S42fmMYxxjlBHBSjFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774608740; c=relaxed/simple; bh=8/rZ9ti1pgZ6fTmi088Bgv37LPpqrgewVTXJEcGJcb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nzOBba6fgBtOWnzh8Ie4qwmAkEyBJJmIPjllF0fgRcozi6A8CT7DXDORJgIbX79YbJYzCACGNbjVuveWpESQaOxg7SUjRfoKde2rdrXWWzj1Yce9s2WICV3orCdKpl7BQ5yejjfCkfB/UbqDwft+CPRHuSvlxsAu7Yx/uKANMaI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lk/v/CYd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lk/v/CYd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58ACEC2BC87; Fri, 27 Mar 2026 10:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774608740; bh=8/rZ9ti1pgZ6fTmi088Bgv37LPpqrgewVTXJEcGJcb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lk/v/CYdZcEEs3K51N7EJ0iv+/sDOlVtIZtNlhmOIrxliny8GtEC3o7CFnF4vELLf Qt4J2lWR9PAcTldcZSLKPT1sKXVHMyLw5ELZkGVpsKloV5EUouFlTMkbzk1JkKH1/V YA6T6cURPFzVTJxl+YqvsnRMz/8921+FQhhPvvGI0mlb+4WO/En3RsV9MDRa4c+lV+ 55qC4ylM4qOZKcyhM2iiDzkyO3YofeQyRGADcnJXyI9Dwgmjtcc1LMYFi/dzeTPzdQ +DOegB0v69cm1+e4DAquTREz+DpDysaVaE4umip28LuUsoRm+J9aGl+1I/3e6fcwys a5VXERkgCjfEw== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1w64na-00000005UzY-18wW; Fri, 27 Mar 2026 11:52:18 +0100 From: Johan Hovold To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 3/4] mmc: vub300: rename probe error labels Date: Fri, 27 Mar 2026 11:52:07 +0100 Message-ID: <20260327105208.1310739-4-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260327105208.1310739-1-johan@kernel.org> References: <20260327105208.1310739-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Error labels should be named after what they do. Rename the probe error labels. Signed-off-by: Johan Hovold --- drivers/mmc/host/vub300.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c index 3c9df27f9fa7..3057a69ff8c4 100644 --- a/drivers/mmc/host/vub300.c +++ b/drivers/mmc/host/vub300.c @@ -2107,19 +2107,19 @@ static int vub300_probe(struct usb_interface *inter= face, command_out_urb =3D usb_alloc_urb(0, GFP_KERNEL); if (!command_out_urb) { retval =3D -ENOMEM; - goto error0; + goto err_put_udev; } command_res_urb =3D usb_alloc_urb(0, GFP_KERNEL); if (!command_res_urb) { retval =3D -ENOMEM; - goto error1; + goto err_free_out_urb; } /* this also allocates memory for our VUB300 mmc host device */ mmc =3D mmc_alloc_host(sizeof(*vub300), &udev->dev); if (!mmc) { retval =3D -ENOMEM; dev_err(&udev->dev, "not enough memory for the mmc_host\n"); - goto error4; + goto err_free_res_urb; } /* MMC core transfer sizes tunable parameters */ mmc->caps =3D 0; @@ -2336,10 +2336,11 @@ static int vub300_probe(struct usb_interface *inter= face, interface_to_InterfaceNumber(interface)); retval =3D mmc_add_host(mmc); if (retval) - goto error6; + goto err_delete_timer; =20 return 0; -error6: + +err_delete_timer: timer_delete_sync(&vub300->inactivity_timer); err_free_host: mmc_free_host(mmc); @@ -2347,12 +2348,13 @@ static int vub300_probe(struct usb_interface *inter= face, * and hence also frees vub300 * which is contained at the end of struct mmc */ -error4: +err_free_res_urb: usb_free_urb(command_res_urb); -error1: +err_free_out_urb: usb_free_urb(command_out_urb); -error0: +err_put_udev: usb_put_dev(udev); + return retval; } =20 --=20 2.52.0 From nobody Thu Apr 2 16:58:53 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96DB12DE709; Fri, 27 Mar 2026 10:52:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774608740; cv=none; b=Sv+EjVDaPf+ZEpV1hmBkcRkwS9yWfNmROaZetKe/ypJ4u6GCWW7gUVTqnnurZA9isuXswNCIQW5kTfcCNaUKiwYWFguAALDBxWEo4L1viovlOFN9VedtQK8JYGPTpmW0DpWh7whS4I9Ry6/9W1KHAQDqiFWNrRduLL27TmrFUFM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774608740; c=relaxed/simple; bh=ZeJGcKziTRNQaiJ+0pmwZ9/PxjWtaz7N3vEC0qiM/YI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CQKnDyd5JYV2cgmzhl/rLa7AlE77Gyagnz75eRxMziKq7Hyd2ysbytxjNxKrtUx40vr2ylwvMjhwrILOtVKIidnmqAgbTP+UTjo/S2eUeCkiz+7N/Zcf+qb7XZ89O0/74nVBzEyqPUooy4j31pgQdyPkQJKLE4GdLtIj5854GLY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VY1UftBf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VY1UftBf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DA0BC2BC9E; Fri, 27 Mar 2026 10:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774608740; bh=ZeJGcKziTRNQaiJ+0pmwZ9/PxjWtaz7N3vEC0qiM/YI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VY1UftBfEVWSDUl6jmhrn03RXYv8oCJIiYp70LUqTGi91DNn5iGnaOOHOeIwmOD7x pYUYNWBTTewj8A2WvJPubIBfnvCUtiiiM/hzBvUuEfDf/lBL1v5ocqd+2Z2sV0PAoC HTb/bpQ3rVKBjIVXQX2Ya48YkLbMIQaKTSFNaRUrBiAK1RQ/4VFOKYG3i78tEDh8GY S8Zsds8nmzQqiFDRaGW/OsBENOlF8QTA9l9kuRnX91ZquIxDtmUEHICjWe+fDTAHkV oq0OPX8opdXEk3vGev9n3QQCTlTqP5yfyl2+MUALHuTwIZSIL5LTYpgMb+Z1tPnRmd 6W+wgofos7odQ== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1w64na-00000005Uza-1BHd; Fri, 27 Mar 2026 11:52:18 +0100 From: Johan Hovold To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 4/4] mmc: vub300: clean up module init Date: Fri, 27 Mar 2026 11:52:08 +0100 Message-ID: <20260327105208.1310739-5-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260327105208.1310739-1-johan@kernel.org> References: <20260327105208.1310739-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Clean up module init by dropping redundant error messages (e.g. allocation and USB driver registration failure will already have been logged) and naming error labels after what they do. Signed-off-by: Johan Hovold --- drivers/mmc/host/vub300.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c index 3057a69ff8c4..6c3cb2f1c9d3 100644 --- a/drivers/mmc/host/vub300.c +++ b/drivers/mmc/host/vub300.c @@ -2429,37 +2429,36 @@ static int __init vub300_init(void) =20 pr_info("VUB300 Driver rom wait states =3D %02X irqpoll timeout =3D %04X", firmware_rom_wait_states, 0x0FFFF & firmware_irqpoll_timeout); + cmndworkqueue =3D create_singlethread_workqueue("kvub300c"); - if (!cmndworkqueue) { - pr_err("not enough memory for the REQUEST workqueue"); - result =3D -ENOMEM; - goto out1; - } + if (!cmndworkqueue) + return -ENOMEM; + pollworkqueue =3D create_singlethread_workqueue("kvub300p"); if (!pollworkqueue) { - pr_err("not enough memory for the IRQPOLL workqueue"); result =3D -ENOMEM; - goto out2; + goto err_destroy_cmdwq; } + deadworkqueue =3D create_singlethread_workqueue("kvub300d"); if (!deadworkqueue) { - pr_err("not enough memory for the EXPIRED workqueue"); result =3D -ENOMEM; - goto out3; + goto err_destroy_pollwq; } + result =3D usb_register(&vub300_driver); - if (result) { - pr_err("usb_register failed. Error number %d", result); - goto out4; - } + if (result) + goto err_destroy_deadwq; + return 0; -out4: + +err_destroy_deadwq: destroy_workqueue(deadworkqueue); -out3: +err_destroy_pollwq: destroy_workqueue(pollworkqueue); -out2: +err_destroy_cmdwq: destroy_workqueue(cmndworkqueue); -out1: + return result; } =20 --=20 2.52.0