Hi Ye, On top of what Greg has already said, few things from my side through the lines. [...] > +static int ljca_mng_link(struct ljca_dev *dev, struct ljca_stub *stub) > +{ > + int ret; > + > + ret = ljca_mng_reset_handshake(stub); > + if (ret) > + return ret; > + > + /* try to enum all the stubs */ > + ljca_mng_enum_gpio(stub); > + ljca_mng_enum_i2c(stub); > + ljca_mng_enum_spi(stub); We are ignoring here the return value. So either make the whole function call chain to be void or please check the return values here. [...] > +static ssize_t ljca_enable_dfu_store(struct device *dev, struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + struct usb_interface *intf = to_usb_interface(dev); > + struct ljca_dev *ljca_dev = usb_get_intfdata(intf); > + struct ljca_stub *mng_stub = ljca_stub_find(ljca_dev, LJCA_MNG_STUB); > + bool enable; > + int ret; > + > + ret = kstrtobool(buf, &enable); > + if (ret) > + return ret; > + > + if (enable) { > + ret = ljca_mng_set_dfu_mode(mng_stub); > + if (ret) > + return ret; > + } What is the DFU mode? Is it an operational mode? Do we enter and exit from it? Does the device leave this mode on its own? What if I write twice in a raw enable? Can I check if I am in DFU mode or not? Would you mind adding some comments here? > + > + return count; > +} > +static DEVICE_ATTR_WO(ljca_enable_dfu); > + > +static ssize_t ljca_trace_level_store(struct device *dev, struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + struct usb_interface *intf = to_usb_interface(dev); > + struct ljca_dev *ljca_dev = usb_get_intfdata(intf); > + struct ljca_stub *diag_stub = ljca_stub_find(ljca_dev, LJCA_DIAG_STUB); > + u8 level; > + int ret; > + > + if (kstrtou8(buf, 0, &level)) > + return -EINVAL; > + > + ret = ljca_diag_set_trace_level(diag_stub, level); > + if (ret) > + return ret; do we need any range check for the levels? What happens if I do: echo "I am too cool" > /sys/.../ljca_trace_level As there were questions here, would you mind adding some comments so that the next reader won't make the same questions? > + > + return count; > +} > +static DEVICE_ATTR_WO(ljca_trace_level); [...] > +static int ljca_probe(struct usb_interface *intf, const struct usb_device_id *id) > +{ > + struct ljca_dev *dev; > + struct usb_endpoint_descriptor *bulk_in, *bulk_out; > + int ret; > + > + /* allocate memory for our device state and initialize it */ > + dev = kzalloc(sizeof(*dev), GFP_KERNEL); devm_kzalloc() Thanks, Andi > + if (!dev) > + return -ENOMEM;