Skip to content

Commit dd4b3c8

Browse files
hoeppnerjaxboe
authored andcommitted
s390/dasd/cio: Interpret ccw_device_get_mdc return value correctly
The max data count (mdc) is an unsigned 16-bit integer value as per AR documentation and is received via ccw_device_get_mdc() for a specific path mask from the CIO layer. The function itself also always returns a positive mdc value or 0 in case mdc isn't supported or couldn't be determined. Though, the comment for this function describes a negative return value to indicate failures. As a result, the DASD device driver interprets the return value of ccw_device_get_mdc() incorrectly. The error case is essentially a dead code path. To fix this behaviour, check explicitly for a return value of 0 and change the comment for ccw_device_get_mdc() accordingly. This fix merely enables the error code path in the DASD functions get_fcx_max_data() and verify_fcx_max_data(). The actual functionality stays the same and is still correct. Reviewed-by: Cornelia Huck <[email protected]> Signed-off-by: Jan Höppner <[email protected]> Acked-by: Peter Oberparleiter <[email protected]> Reviewed-by: Stefan Haberland <[email protected]> Signed-off-by: Stefan Haberland <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent b3c6a59 commit dd4b3c8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

drivers/s390/block/dasd_eckd.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,8 @@ static u32 get_fcx_max_data(struct dasd_device *device)
11281128
{
11291129
struct dasd_eckd_private *private = device->private;
11301130
int fcx_in_css, fcx_in_gneq, fcx_in_features;
1131-
int tpm, mdc;
1131+
unsigned int mdc;
1132+
int tpm;
11321133

11331134
if (dasd_nofcx)
11341135
return 0;
@@ -1142,7 +1143,7 @@ static u32 get_fcx_max_data(struct dasd_device *device)
11421143
return 0;
11431144

11441145
mdc = ccw_device_get_mdc(device->cdev, 0);
1145-
if (mdc < 0) {
1146+
if (mdc == 0) {
11461147
dev_warn(&device->cdev->dev, "Detecting the maximum supported data size for zHPF requests failed\n");
11471148
return 0;
11481149
} else {
@@ -1153,12 +1154,12 @@ static u32 get_fcx_max_data(struct dasd_device *device)
11531154
static int verify_fcx_max_data(struct dasd_device *device, __u8 lpm)
11541155
{
11551156
struct dasd_eckd_private *private = device->private;
1156-
int mdc;
1157+
unsigned int mdc;
11571158
u32 fcx_max_data;
11581159

11591160
if (private->fcx_max_data) {
11601161
mdc = ccw_device_get_mdc(device->cdev, lpm);
1161-
if ((mdc < 0)) {
1162+
if (mdc == 0) {
11621163
dev_warn(&device->cdev->dev,
11631164
"Detecting the maximum data size for zHPF "
11641165
"requests failed (rc=%d) for a new path %x\n",

drivers/s390/cio/device_ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ EXPORT_SYMBOL(ccw_device_tm_start_timeout);
635635
* @mask: mask of paths to use
636636
*
637637
* Return the number of 64K-bytes blocks all paths at least support
638-
* for a transport command. Return values <= 0 indicate failures.
638+
* for a transport command. Return value 0 indicates failure.
639639
*/
640640
int ccw_device_get_mdc(struct ccw_device *cdev, u8 mask)
641641
{

0 commit comments

Comments
 (0)