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

Configure Feed

Select the types of activity you want to include in your feed.

slimbus: stream: handle unsupported bitrates for presence rate

Handle errors of getting presence rate for unsupported stream bitrate,
instead of sending -EINVAL in change content message.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@somainline.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20221118065246.6835-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Krzysztof Kozlowski and committed by
Greg Kroah-Hartman
434d2572 63c60a22

+9 -2
+9 -2
drivers/slimbus/stream.c
··· 204 204 { 205 205 struct slim_controller *ctrl = rt->dev->ctrl; 206 206 struct slim_port *port; 207 - int num_ports, i, port_id; 207 + int num_ports, i, port_id, prrate; 208 208 209 209 if (rt->ports) { 210 210 dev_err(&rt->dev->dev, "Stream already Prepared\n"); ··· 220 220 rt->rate = cfg->rate; 221 221 rt->bps = cfg->bps; 222 222 rt->direction = cfg->direction; 223 + 224 + prrate = slim_get_prate_code(cfg->rate); 225 + if (prrate < 0) { 226 + dev_err(&rt->dev->dev, "Cannot get presence rate for rate %d Hz\n", 227 + cfg->rate); 228 + return prrate; 229 + } 223 230 224 231 if (cfg->rate % ctrl->a_framer->superfreq) { 225 232 /* ··· 248 241 port = &rt->ports[i]; 249 242 port->state = SLIM_PORT_DISCONNECTED; 250 243 port->id = port_id; 251 - port->ch.prrate = slim_get_prate_code(cfg->rate); 244 + port->ch.prrate = prrate; 252 245 port->ch.id = cfg->chs[i]; 253 246 port->ch.data_fmt = SLIM_CH_DATA_FMT_NOT_DEFINED; 254 247 port->ch.aux_fmt = SLIM_CH_AUX_FMT_NOT_APPLICABLE;