Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions packages/base/any/kernels/modules/ym2651y.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,7 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev)
goto exit;
}

buf = min_t(u8, buf, ARRAY_SIZE(data->mfr_model)-2);
status = ym2651y_read_block(client, command, data->mfr_model, buf+1);
data->mfr_model[buf+1] = '\0';

Expand All @@ -838,6 +839,7 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev)
goto exit;
}

buf = min_t(u8, buf, ARRAY_SIZE(data->mfr_model_opt)-2);
status = ym2651y_read_block(client, command, data->mfr_model_opt, buf+1);
data->mfr_model_opt[buf+1] = '\0';

Expand Down Expand Up @@ -873,13 +875,10 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev)
goto exit;
}

buf = min_t(u8, buf, ARRAY_SIZE(data->mfr_serial)-2);
status = ym2651y_read_block(client, command, data->mfr_serial, buf+1);
if (data->mfr_serial[0] < ARRAY_SIZE(data->mfr_serial)-2) {
data->mfr_serial[data->mfr_serial[0] + 1] = '\0';
}
else {
data->mfr_serial[ARRAY_SIZE(data->mfr_serial)-1] = '\0';
}

data->mfr_serial[buf+1] = '\0';

if (status < 0) {
dev_dbg(&client->dev, "reg %d, err %d\n", command, status);
Expand Down