Shares of electronics company HP (HPQ -0.25%) -- not to be confused with business cloud company HP Enterprises -- showed up in Warren Buffett's stock portfolio this past spring. In a regulatory filing, Berkshire Hathaway (BRK.A 0.64%) (BRK.B 0.54%) revealed it had taken a more than 11% stake in HP, a position valued at nearly $3.8 billion.

The consumer electronics industry has come under pressure as of late, though, and shares of the slow-and-steady HP have fallen about 15% so far this year. Where will HP be five years from now? And should you follow Buffett's lead and buy?

A slow-but-steady bet on consumer spending

HP is a top manufacturer of home and business electronics. It reports its sales in two segments: personal systems (PCs, laptops, accessories) and printing (printers, ink, and even some really high-tech 3D printer sales too). Since it split with its cloud division HP Enterprises in 2015, HP has been a conservative bet on tech devices.

HPQ Chart

Data by YCharts.

The pandemic sparked a work-from-home sales rush the last two years. However, that elevated spending appears to be grinding to a halt now. Chipmaker Micron Technology indicated in its latest quarterly report at the end of June that there's a glut of consumer tech devices on the market, and it could take a couple quarters to work through it. In other words, HP's sales are likely to hit a speed bump this year, thus the recent decline in its share price. 

Not that HP was hurtling down the road at high speeds in the first place. PCs and printers aren't exactly the fastest-growing segments of the tech industry. It's a cyclical market that will generally follow consumer and business spending trends -- which tend to gradually move up and to the right at a shallow pitch over time. This situation is not likely to change five years from now. HP's lineup of tech will advance, but that will be driven by its tech partners (for example, semiconductor companies like Nvidia and software companies like Microsoft) more so than it will be driven by HP.

Cheap, but cheap for a reason?

So why did Buffett add HP to the Berkshire portfolio? Stability, slow-and-steady growth, and return of capital to shareholders. Through the past 12 months, HP generated $5.32 billion in free cash flow (a free-cash-flow margin of only 8%), but it's been returning basically all of that to shareholders via dividends and share repurchases. 

In fiscal 2021 (the year ended Oct. 31, 2021), stock repurchases totaled $6.25 billion and dividends paid totaled $938 million. Through the first six months of fiscal 2022 (the six months ended April 2022), stock repurchases totaled $2.52 billion and dividends paid totaled $533 million. As of this writing, shares trade for a meager 6.8 times trailing 12-month free cash flow, and the dividend yields 3.1% a year.

Given HP has ample competition in the personal computing and office equipment market, there's little reason to believe the stock is suddenly going to race higher. On the contrary, the company knows what it is, and it isn't investing to try and effect any radical change. It's all about return of capital at this point. HP's business will more or less look the same five years from now.

Should you buy HP stock? If you're into cheap valuations and income-generating investments, sure, give this one a look. If not, simply owning a slice of Berkshire Hathaway stock gives you all the exposure you'd ever need or want to HP over the course of the next five years.