Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[S390] cio: ccw_device_online_store return -EINVAL in case of missing driver

If no driver is attached to a device or the driver provides no
set_online/set_offline function, setting this device online/offline
via its sysfs online attribute will silently fail but return success.

This patch changes the behavior to return -EINVAL in those cases.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Sebastian Ott and committed by
Martin Schwidefsky
7cd40314 dbedd0ee

+6 -4
+6 -4
drivers/s390/cio/device.c
··· 487 487 spin_lock_irq(cdev->ccwlock); 488 488 ccw_device_sched_todo(cdev, CDEV_TODO_UNREG_EVAL); 489 489 spin_unlock_irq(cdev->ccwlock); 490 - } else if (cdev->online && cdev->drv && cdev->drv->set_offline) 490 + return 0; 491 + } 492 + if (cdev->drv && cdev->drv->set_offline) 491 493 return ccw_device_set_offline(cdev); 492 - return 0; 494 + return -EINVAL; 493 495 } 494 496 495 497 static int online_store_recog_and_online(struct ccw_device *cdev) ··· 508 506 return -EAGAIN; 509 507 } 510 508 if (cdev->drv && cdev->drv->set_online) 511 - ccw_device_set_online(cdev); 512 - return 0; 509 + return ccw_device_set_online(cdev); 510 + return -EINVAL; 513 511 } 514 512 515 513 static int online_store_handle_online(struct ccw_device *cdev, int force)