The patch titled drm: fix error returns, sysfs error handling has been removed from the -mm tree. Its filename was drm-fix-error-returns-sysfs-error-handling.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ Subject: drm: fix error returns, sysfs error handling From: Jeff Garzik <jeff@xxxxxxxxxx> - callers of drm_sysfs_create() and drm_sysfs_device_add() looked for errors using IS_ERR(), but the functions themselves only ever returned NULL on error. Fixed. - unwind from, and propagate sysfs errors Signed-off-by: Jeff Garzik <jeff@xxxxxxxxxx> Cc: Dave Airlie <airlied@xxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/char/drm/drm_sysfs.c | 43 ++++++++++++++++++++++++++------- 1 files changed, 35 insertions(+), 8 deletions(-) diff -puN drivers/char/drm/drm_sysfs.c~drm-fix-error-returns-sysfs-error-handling drivers/char/drm/drm_sysfs.c --- a/drivers/char/drm/drm_sysfs.c~drm-fix-error-returns-sysfs-error-handling +++ a/drivers/char/drm/drm_sysfs.c @@ -42,13 +42,24 @@ static CLASS_ATTR(version, S_IRUGO, vers struct class *drm_sysfs_create(struct module *owner, char *name) { struct class *class; + int err; class = class_create(owner, name); - if (!class) - return class; + if (!class) { + err = -ENOMEM; + goto err_out; + } + + err = class_create_file(class, &class_attr_version); + if (err) + goto err_out_class; - class_create_file(class, &class_attr_version); return class; + +err_out_class: + class_destroy(class); +err_out: + return ERR_PTR(err); } /** @@ -96,20 +107,36 @@ static struct class_device_attribute cla struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head) { struct class_device *class_dev; - int i; + int i, j, err; class_dev = class_device_create(cs, NULL, MKDEV(DRM_MAJOR, head->minor), &(head->dev->pdev)->dev, "card%d", head->minor); - if (!class_dev) - return NULL; + if (!class_dev) { + err = -ENOMEM; + goto err_out; + } class_set_devdata(class_dev, head); - for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) - class_device_create_file(class_dev, &class_device_attrs[i]); + for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) { + err = class_device_create_file(class_dev, + &class_device_attrs[i]); + if (err) + goto err_out_files; + } + return class_dev; + +err_out_files: + if (i > 0) + for (j = 0; j < i; j++) + class_device_remove_file(class_dev, + &class_device_attrs[i]); + class_device_unregister(class_dev); +err_out: + return ERR_PTR(err); } /** _ Patches currently in -mm which might be from jeff@xxxxxxxxxx are origin.patch git-acpi.patch git-cpufreq.patch input-handle-sysfs-errors.patch input-drivers-handle-sysfs-errors.patch git-libata-all.patch libata-revamp-blacklist-support-to-allow-multiple-kinds.patch via-pata-controller-xfer-fixes.patch ahci-ati-sb600-sata-support-for-various-modes.patch git-mtd.patch git-netdev-all.patch libphy-dont-do-that.patch update-smc91x-driver-with-arm-versatile-board-info.patch 8139too-force-media-setting-fix.patch tulip-fix-shutdown-dma-irq-race.patch git-ioat.patch git-pcmcia.patch r8169-driver-corega-support-patch.patch serial-handle-pci_enable_device-failure-upon-resume.patch git-pciseg.patch mpt-fusion-handle-pci-layer-error-on-resume.patch scsi-aha1740-handle-scsi-api-errors.patch scsi-minor-bug-fixes-and-cleanups.patch i2o-more-error-checking.patch pnp-handle-sysfs-errors.patch rtc-handle-sysfs-errors.patch sound-oss-emu10k1-handle-userspace-copy-errors.patch spi-improve-sysfs-compiler-complaint-handling.patch remove-double-cast-to-same-type.patch via82cxxx-handle-error-condition-properly.patch atyfb-rivafb-minor-fixes.patch md-conditionalize-some-code.patch user-of-the-jiffies-rounding-patch-ata-subsystem.patch git-gccbug.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html