Shares of Western digital rose nearly 5 percent on Wednesday after an analyst raised his rating for the stock to neutral from underweight.

J.P. Morgan analyst Mark Moskowitz said demand particularly in PC and hard drive trends remain and high activity build eased in late march, meaningfully weak on a year-over-year basis.

We think the worst-case scenario has been averted for now, he wrote in a note to clients, according to Barrons. We missed the stock's run but think WD should trade more in line with the peers, hence our move to Neutral.

Moskowitz set his price target to $19 from $12, below yesterday's $20.25 closng price.

Western Digital closed up $1.00, or 4.94 percent to close at $21.25.