Skip to content

Commit 26258cb

Browse files
committed
Merge branch 's390-qeth-fixes'
Julian Wiedmann says: ==================== s390/qeth: fixes 2019-09-26 please apply two qeth patches for -net. The first is a trivial cleanup required for patch #2 by Jean, which fixes a potential endless loop. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents d4ce580 + 048a7f8 commit 26258cb

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

drivers/s390/net/qeth_core_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static void qeth_put_reply(struct qeth_reply *reply)
610610
static void qeth_issue_ipa_msg(struct qeth_ipa_cmd *cmd, int rc,
611611
struct qeth_card *card)
612612
{
613-
char *ipa_name;
613+
const char *ipa_name;
614614
int com = cmd->hdr.command;
615615
ipa_name = qeth_get_ipa_cmd_name(com);
616616
if (rc)

drivers/s390/net/qeth_core_mpc.c

+16-17
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ EXPORT_SYMBOL_GPL(IPA_PDU_HEADER);
148148

149149
struct ipa_rc_msg {
150150
enum qeth_ipa_return_codes rc;
151-
char *msg;
151+
const char *msg;
152152
};
153153

154-
static struct ipa_rc_msg qeth_ipa_rc_msg[] = {
154+
static const struct ipa_rc_msg qeth_ipa_rc_msg[] = {
155155
{IPA_RC_SUCCESS, "success"},
156156
{IPA_RC_NOTSUPP, "Command not supported"},
157157
{IPA_RC_IP_TABLE_FULL, "Add Addr IP Table Full - ipv6"},
@@ -219,23 +219,23 @@ static struct ipa_rc_msg qeth_ipa_rc_msg[] = {
219219

220220

221221

222-
char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc)
222+
const char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc)
223223
{
224-
int x = 0;
225-
qeth_ipa_rc_msg[sizeof(qeth_ipa_rc_msg) /
226-
sizeof(struct ipa_rc_msg) - 1].rc = rc;
227-
while (qeth_ipa_rc_msg[x].rc != rc)
228-
x++;
224+
int x;
225+
226+
for (x = 0; x < ARRAY_SIZE(qeth_ipa_rc_msg) - 1; x++)
227+
if (qeth_ipa_rc_msg[x].rc == rc)
228+
return qeth_ipa_rc_msg[x].msg;
229229
return qeth_ipa_rc_msg[x].msg;
230230
}
231231

232232

233233
struct ipa_cmd_names {
234234
enum qeth_ipa_cmds cmd;
235-
char *name;
235+
const char *name;
236236
};
237237

238-
static struct ipa_cmd_names qeth_ipa_cmd_names[] = {
238+
static const struct ipa_cmd_names qeth_ipa_cmd_names[] = {
239239
{IPA_CMD_STARTLAN, "startlan"},
240240
{IPA_CMD_STOPLAN, "stoplan"},
241241
{IPA_CMD_SETVMAC, "setvmac"},
@@ -267,13 +267,12 @@ static struct ipa_cmd_names qeth_ipa_cmd_names[] = {
267267
{IPA_CMD_UNKNOWN, "unknown"},
268268
};
269269

270-
char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd)
270+
const char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd)
271271
{
272-
int x = 0;
273-
qeth_ipa_cmd_names[
274-
sizeof(qeth_ipa_cmd_names) /
275-
sizeof(struct ipa_cmd_names)-1].cmd = cmd;
276-
while (qeth_ipa_cmd_names[x].cmd != cmd)
277-
x++;
272+
int x;
273+
274+
for (x = 0; x < ARRAY_SIZE(qeth_ipa_cmd_names) - 1; x++)
275+
if (qeth_ipa_cmd_names[x].cmd == cmd)
276+
return qeth_ipa_cmd_names[x].name;
278277
return qeth_ipa_cmd_names[x].name;
279278
}

drivers/s390/net/qeth_core_mpc.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,8 @@ enum qeth_ipa_arp_return_codes {
797797
QETH_IPA_ARP_RC_Q_NO_DATA = 0x0008,
798798
};
799799

800-
extern char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc);
801-
extern char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd);
800+
extern const char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc);
801+
extern const char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd);
802802

803803
#define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
804804
sizeof(struct qeth_ipacmd_setassparms_hdr))

0 commit comments

Comments
 (0)