Robert Downey Jr. Ordered Freed!

He’s free at least … or at least very soon. Reuters reports that a California state appeals court on Wednesday ordered actor Robert Downey Jr. freed, his spokesman said.

Spokesman Alan Nierob said that the court had granted an appeal by Downey, who was serving a three-year jail term for drug possession and who had argued via his lawyers that an L.A. Superior Court judge had miscalculated his sentence.

Downey could be released as early as today from the California Substance Abuse Facility and State Prison in Corcoran after bail arrangements are made through a court, Nierob said.

Nairobi did not know the details of the ruling. Downey, 35, was scheduled to be released in November with credit for time off for good behavior.

Lawyers for Downey argued that the Malibu judge who sentenced the Oscar-nominated actor in August should have given him credit for 53 days served in a rehabilitation program.

Downey’s films include “Less Than Zero,” “The Pick-Up Artist” and “Two Girls and a Guy.” He received an Oscar nomination in for the title role in 1992’s “Chaplin.”