@@ -537,6 +537,15 @@ static int ses_intf_add(struct device *cdev,
if (result)
goto recv_failed;
+ /* If enclosure only supports Short Enclosure Status page (08),
+ * it returns that page regardless of what we requested, and
+ * only returns vendor-specific status. There is nothing wrong
+ * with such enclosures, we just can't make use of them. */
+ if (hdr_buf[0] == 8) {
+ err = -ENODEV;
+ goto err_init_free_nomsg;
+ }
+
len = (hdr_buf[2] << 8) + hdr_buf[3] + 4;
buf = kzalloc(len, GFP_KERNEL);
if (!buf)
@@ -646,9 +655,10 @@ static int ses_intf_add(struct device *cdev,
kfree(ses_dev->page2);
kfree(ses_dev->page1);
err_init_free:
+ sdev_printk(KERN_ERR, sdev, "Failed to bind enclosure %d\n",
err);
+ err_init_free_nomsg:
kfree(ses_dev);
kfree(hdr_buf);
- sdev_printk(KERN_ERR, sdev, "Failed to bind enclosure %d\n",
err);
return err;