Re: [PATCH v2 1/4] cxl: add a firmware update mechanism using the sysfs firmware loader

Jonathan Cameron
2023-06-09T11:07:11Z

> >
> > > +       struct fw_upload *fwl;
> > > +       int rc;
> > > +
> > > +       if (!test_bit(CXL_MEM_COMMAND_ID_GET_FW_INFO, cxlds->enabled_cmds))
> > > +               return 0;
> > > +
> > > +       fwl = firmware_upload_register(THIS_MODULE, &cxlmd->dev,
> > > +                                      dev_name(&cxlmd->dev),
> > > +                                      &cxl_memdev_fw_ops, cxlds);
> > > +       if (IS_ERR(fwl)) {
> > > +               dev_err(&cxlmd->dev, "Failed to register firmware loader\n");
> > > +               return PTR_ERR(fwl);
> >
> > It's called from probe only so could use dev_err_probe() for slight
> > simplification.
>
> From what I can tell, this ends up looking like:
>
> fwl = firmware_upload_register(THIS_MODULE, dev,
> dev_name(dev),
> &cxl_memdev_fw_ops, cxlds);
> rc = dev_err_probe(dev, PTR_ERR(fwl),
> "Failed to register firmware loader\n");
> if (rc)
> return rc;
>
> Is that what you meant? Happy to make the change if so.

fwl = firmware_upload_register(THIS_MODULE, dev, dev_name(dev),
&cxl_memdev_fw_ops, cxlds);
if (IS_ERR(fwl)
return dev_err_probe(dev, PTR_ERR(fwl),
"Failed to register firmware loader\n");