Re: [PATCH v2] usb: mtu3: Convert to platform remove callback returning void

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Greg,

On Mon, Oct 02, 2023 at 04:39:47PM +0200, Greg Kroah-Hartman wrote:
> On Thu, Sep 14, 2023 at 10:02:51PM +0200, Uwe Kleine-König wrote:
> > @@ -469,8 +469,17 @@ static int mtu3_remove(struct platform_device *pdev)
> >  		ssusb_gadget_exit(ssusb);
> >  		ssusb_host_exit(ssusb);
> >  		break;
> > -	default:
> > -		return -EINVAL;
> > +	case USB_DR_MODE_UNKNOWN:
> > +		/*
> > +		 * This cannot happen because with dr_mode ==
> > +		 * USB_DR_MODE_UNKNOWN, .probe() doesn't succeed and so
> > +		 * .remove() wouldn't be called at all. However (little
> > +		 * surprising) the compiler isn't smart enough to see that, so
> > +		 * we explicitly have this case item to not make the compiler
> > +		 * wail about an unhandled enumeration value.
> > +		 */
> > +		WARN_ON(1);
> 
> Please don't add new WARN_ON() calls to the kernel, print out a big
> error message and return, don't reboot the machine.

Huh, printing out an loud error message was my intention. It's news to
me that WARN_ON() reboots the machine?! I thought BUG_ON() was the one
with the effects you describe that I shouldn't use.

I'll retest and assuming you're right, rework accordingly.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux