static int __init raw_init(vodi)
{
  int i;
  dev_t dev = MKDEV(RAW_MAJOR, 0);

  if (register_chrdev_region(dev, MAX_RAW_MINORS, "raw"))
    goto error;

  cdev_init(&raw_cdev, &raw_fops);
  if (cdev_add(&raw_cdev, dev, MAX_RAW_MINORS)) {
    unregister_chrdev_region(dev, MAX_RAW_MINORS);
    goto error;
  }

  ...
  return 0;

error:
  ...
  return 1;
}