0001-Avoid-calling-chn_wrfeed-with-an-empty-soft-buffer.patch

fgudin, 05/03/2013 05:30 AM

Download (2.56 KB)

View differences:

sys/dev/sound/pcm/channel.c
231 231
	if ((c->flags & (CHN_F_MAPPED | CHN_F_VIRTUAL)) || !(c->flags & CHN_F_TRIGGERED))
232 232
		return;
233 233
	chn_dmaupdate(c);
234
	if (sndbuf_getsize(c->bufsoft) == 0) {
235
		DEB(kprintf("chn_wrupdate: avoid calling chn_wrfeed without any data in soft buffer");)
236
		return;
237
	}
234 238
	ret = chn_wrfeed(c);
235 239
	/* tell the driver we've updated the primary buffer */
236 240
	chn_trigger(c, PCMTRIG_EMLDMAWR);
......
285 289
	/* update pointers in primary buffer */
286 290
	chn_dmaupdate(c);
287 291
	/* ...and feed from secondary to primary */
292
	if (sndbuf_getsize(c->bufsoft) == 0) {
293
		DEB(kprintf("chn_wrintr: avoid calling chn_wrfeed without any data in soft buffer");)
294
		return;
295
	}
288 296
	ret = chn_wrfeed(c);
289 297
	/* tell the driver we've updated the primary buffer */
290 298
	chn_trigger(c, PCMTRIG_EMLDMAWR);
......
734 742
			if (resid == resid_p)
735 743
				count--;
736 744
			if (resid > resid_p)
737
				DEB(printf("chn_flush: buffer length increasind %d -> %d\n", resid_p, resid));
745
				DEB(kprintf("chn_flush: buffer length increasind %d -> %d\n", resid_p, resid));
738 746
			resid_p = resid;
739 747
		}
740 748
   	}
......
1330 1338
			desc.type = FEEDER_MIXER;
1331 1339
			desc.in = 0;
1332 1340
		} else {
1333
			DEB(printf("can't decide which feeder type to use!\n"));
1341
			DEB(kprintf("can't decide which feeder type to use!\n"));
1334 1342
			return EOPNOTSUPP;
1335 1343
		}
1336 1344
		desc.out = c->format;
......
1379 1387
			tmp[0] = fc->desc->in;
1380 1388
			tmp[1] = 0;
1381 1389
			if (chn_fmtchain(c, tmp) == 0) {
1382
				DEB(printf("failed\n"));
1390
				DEB(kprintf("failed\n"));
1383 1391

  
1384 1392
				return ENODEV;
1385 1393
			}
1386
 			DEB(printf("ok\n"));
1394
			DEB(kprintf("ok\n"));
1387 1395

  
1388 1396
			err = chn_addfeeder(c, fc, fc->desc);
1389 1397
			if (err) {
......
1403 1411
 		hwfmt = chn_fmtchain(c, fmtlist);
1404 1412

  
1405 1413
	if (hwfmt == 0 || !fmtvalid(hwfmt, fmtlist)) {
1406
		DEB(printf("Invalid hardware format: 0x%08x\n", hwfmt));
1414
		DEB(kprintf("Invalid hardware format: 0x%08x\n", hwfmt));
1407 1415
		return ENODEV;
1408 1416
	}
1409 1417

  
1410
-