Re: [PATCH v5 2/2] drm/tiny: add driver for Apple Touch Bars in x86 Macs

From: andriy.shevchenko@xxxxxxxxxxxxxxx
Date: Tue Feb 25 2025 - 08:28:18 EST


On Tue, Feb 25, 2025 at 12:58:17PM +0100, Thomas Zimmermann wrote:
> Am 25.02.25 um 11:33 schrieb andriy.shevchenko@xxxxxxxxxxxxxxx:
> > On Tue, Feb 25, 2025 at 10:09:42AM +0000, Aditya Garg wrote:

...

> > > +static int appletbdrm_probe(struct usb_interface *intf,
> > > + const struct usb_device_id *id)
> > > +{
> > > + struct usb_endpoint_descriptor *bulk_in, *bulk_out;
> > > + struct device *dev = &intf->dev;
> > > + struct appletbdrm_device *adev;
> > > + struct drm_device *drm;
> > > + int ret;
> > > +
> > > + ret = usb_find_common_endpoints(intf->cur_altsetting, &bulk_in, &bulk_out, NULL, NULL);
> > > + if (ret) {
> > > + drm_err(drm, "Failed to find bulk endpoints\n");
> > This is simply wrong (and in this case even lead to crash in some circumstances).
> > drm_err() may not be used here. That's my point in previous discussions.
> > Independently on the subsystem the ->probe() for the sake of consistency and
> > being informative should only rely on struct device *dev,
>
> That's never going to work with DRM. There's so much code in a DRM probe
> function that uses the DRM error functions.

> This specific instance here is wrong, as the drm pointer hasn't been
> initialized. But as soon as it is, it's much better to use drm_err() and
> friends. It will do the right thing and give consistent output across
> drivers.

Okay and my question was how is it possible to create drm_err_probe() for such
cases?

> > > + return ret;
> > > + }

--
With Best Regards,
Andy Shevchenko