Commit ee2f38b3 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Greg Kroah-Hartman
Browse files

usb: host: u132-hcd: Drop if with an always true condition



A platform device's .remove() callback is only ever called after
.probe() successfully completed. After such a successful call,
platform_get_drvdata() doesn't return NULL. Simplify accordingly.

Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230321101911.342538-3-u.kleine-koenig@pengutronix.de


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9e679553
Loading
Loading
Loading
Loading
+34 −32
Original line number Diff line number Diff line
@@ -2977,8 +2977,8 @@ static const struct hc_driver u132_hc_driver = {
static int u132_remove(struct platform_device *pdev)
{
	struct usb_hcd *hcd = platform_get_drvdata(pdev);
	if (hcd) {
	struct u132 *u132 = hcd_to_u132(hcd);

	if (u132->going++ > 1) {
		dev_err(&u132->platform_dev->dev,
			"already being removed\n");
@@ -3009,9 +3009,6 @@ static int u132_remove(struct platform_device *pdev)
		u132_u132_put_kref(u132);
		return 0;
	}
	} else {
		return 0;
	}
}

static void u132_initialise(struct u132 *u132, struct platform_device *pdev)
@@ -3092,6 +3089,11 @@ static int u132_probe(struct platform_device *pdev)
	if (retval)
		return retval;

	/*
	 * Note that after a successful call of usb_create_hcd(),
	 * dev_set_drvdata() was called such that platform_get_drvdata(pdev)
	 * returns hcd later on.
	 */
	hcd = usb_create_hcd(&u132_hc_driver, &pdev->dev, dev_name(&pdev->dev));
	if (!hcd) {
		printk(KERN_ERR "failed to create the usb hcd struct for U132\n");