Commit 8d7ac904 authored by Jan Höppner's avatar Jan Höppner Committed by Jens Axboe

s390/dasd: Remove unnecessary errorstring generation

In quite a few cases an errorstring is generated using snprintf() before
it's passed to dev_err(). This indirection is unnecessary and all
information can simply be passed directly to dev_err() instead.
The errrorstring and ERRORLENGTH definitions are removed entirely.

While at it, rephrase the error messages to provide more context where
possible. Also, fix a few incorrectly used format specifier (e.g. %x02
-> %02x) in those messages.
Signed-off-by: default avatarJan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: default avatarStefan Haberland <sth@linux.ibm.com>
Signed-off-by: default avatarStefan Haberland <sth@linux.ibm.com>
Link: https://lore.kernel.org/r/20240208164248.540985-4-sth@linux.ibm.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 9c386d0f
...@@ -1301,7 +1301,6 @@ int dasd_term_IO(struct dasd_ccw_req *cqr) ...@@ -1301,7 +1301,6 @@ int dasd_term_IO(struct dasd_ccw_req *cqr)
{ {
struct dasd_device *device; struct dasd_device *device;
int retries, rc; int retries, rc;
char errorstring[ERRORLENGTH];
/* Check the cqr */ /* Check the cqr */
rc = dasd_check_cqr(cqr); rc = dasd_check_cqr(cqr);
...@@ -1340,10 +1339,8 @@ int dasd_term_IO(struct dasd_ccw_req *cqr) ...@@ -1340,10 +1339,8 @@ int dasd_term_IO(struct dasd_ccw_req *cqr)
rc = 0; rc = 0;
break; break;
default: default:
/* internal error 10 - unknown rc*/ dev_err(&device->cdev->dev,
snprintf(errorstring, ERRORLENGTH, "10 %d", rc); "Unexpected error during request termination %d\n", rc);
dev_err(&device->cdev->dev, "An error occurred in the "
"DASD device driver, reason=%s\n", errorstring);
BUG(); BUG();
break; break;
} }
...@@ -1362,7 +1359,6 @@ int dasd_start_IO(struct dasd_ccw_req *cqr) ...@@ -1362,7 +1359,6 @@ int dasd_start_IO(struct dasd_ccw_req *cqr)
{ {
struct dasd_device *device; struct dasd_device *device;
int rc; int rc;
char errorstring[ERRORLENGTH];
/* Check the cqr */ /* Check the cqr */
rc = dasd_check_cqr(cqr); rc = dasd_check_cqr(cqr);
...@@ -1382,10 +1378,8 @@ int dasd_start_IO(struct dasd_ccw_req *cqr) ...@@ -1382,10 +1378,8 @@ int dasd_start_IO(struct dasd_ccw_req *cqr)
return -EPERM; return -EPERM;
} }
if (cqr->retries < 0) { if (cqr->retries < 0) {
/* internal error 14 - start_IO run out of retries */ dev_err(&device->cdev->dev,
sprintf(errorstring, "14 %p", cqr); "Start I/O ran out of retries %p\n", cqr);
dev_err(&device->cdev->dev, "An error occurred in the DASD "
"device driver, reason=%s\n", errorstring);
cqr->status = DASD_CQR_ERROR; cqr->status = DASD_CQR_ERROR;
return -EIO; return -EIO;
} }
...@@ -1463,11 +1457,8 @@ int dasd_start_IO(struct dasd_ccw_req *cqr) ...@@ -1463,11 +1457,8 @@ int dasd_start_IO(struct dasd_ccw_req *cqr)
"not accessible"); "not accessible");
break; break;
default: default:
/* internal error 11 - unknown rc */
snprintf(errorstring, ERRORLENGTH, "11 %d", rc);
dev_err(&device->cdev->dev, dev_err(&device->cdev->dev,
"An error occurred in the DASD device driver, " "Unexpected error during request start %d", rc);
"reason=%s\n", errorstring);
BUG(); BUG();
break; break;
} }
...@@ -1904,8 +1895,6 @@ static void __dasd_device_process_ccw_queue(struct dasd_device *device, ...@@ -1904,8 +1895,6 @@ static void __dasd_device_process_ccw_queue(struct dasd_device *device,
static void __dasd_process_cqr(struct dasd_device *device, static void __dasd_process_cqr(struct dasd_device *device,
struct dasd_ccw_req *cqr) struct dasd_ccw_req *cqr)
{ {
char errorstring[ERRORLENGTH];
switch (cqr->status) { switch (cqr->status) {
case DASD_CQR_SUCCESS: case DASD_CQR_SUCCESS:
cqr->status = DASD_CQR_DONE; cqr->status = DASD_CQR_DONE;
...@@ -1917,11 +1906,8 @@ static void __dasd_process_cqr(struct dasd_device *device, ...@@ -1917,11 +1906,8 @@ static void __dasd_process_cqr(struct dasd_device *device,
cqr->status = DASD_CQR_TERMINATED; cqr->status = DASD_CQR_TERMINATED;
break; break;
default: default:
/* internal error 12 - wrong cqr status*/
snprintf(errorstring, ERRORLENGTH, "12 %p %x02", cqr, cqr->status);
dev_err(&device->cdev->dev, dev_err(&device->cdev->dev,
"An error occurred in the DASD device driver, " "Unexpected CQR status %p %02x", cqr, cqr->status);
"reason=%s\n", errorstring);
BUG(); BUG();
} }
if (cqr->callback) if (cqr->callback)
......
...@@ -398,7 +398,6 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense) ...@@ -398,7 +398,6 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense)
struct dasd_device *device = erp->startdev; struct dasd_device *device = erp->startdev;
char msg_format = (sense[7] & 0xF0); char msg_format = (sense[7] & 0xF0);
char msg_no = (sense[7] & 0x0F); char msg_no = (sense[7] & 0x0F);
char errorstring[ERRORLENGTH];
switch (msg_format) { switch (msg_format) {
case 0x00: /* Format 0 - Program or System Checks */ case 0x00: /* Format 0 - Program or System Checks */
...@@ -1004,12 +1003,9 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense) ...@@ -1004,12 +1003,9 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense)
} }
break; break;
default: /* unknown message format - should not happen default:
internal error 03 - unknown message format */
snprintf(errorstring, ERRORLENGTH, "03 %x02", msg_format);
dev_err(&device->cdev->dev, dev_err(&device->cdev->dev,
"An error occurred in the DASD device driver, " "Unknown message format %02x", msg_format);
"reason=%s\n", errorstring);
break; break;
} /* end switch message format */ } /* end switch message format */
......
...@@ -113,9 +113,6 @@ do { \ ...@@ -113,9 +113,6 @@ do { \
__dev_id.ssid, __dev_id.devno, d_data); \ __dev_id.ssid, __dev_id.devno, d_data); \
} while (0) } while (0)
/* limit size for an errorstring */
#define ERRORLENGTH 30
/* definition of dbf debug levels */ /* definition of dbf debug levels */
#define DBF_EMERG 0 /* system is unusable */ #define DBF_EMERG 0 /* system is unusable */
#define DBF_ALERT 1 /* action must be taken immediately */ #define DBF_ALERT 1 /* action must be taken immediately */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment