
21 Cal.Rptr.3d 926 (2004)
124 Cal.App.4th 1481
The PEOPLE, Plaintiff and Respondent,
v.
Peter GUTIERREZ, Defendant and Appellant.
No. B169161.
Court of Appeal, Second District, Division Six.
December 16, 2004.
As Modified on Denial of Rehearing January 13, 2005.
*927 Richard C. Gilman, Oxnard, under appointment by the Court of Appeal, for Defendant and Appellant.
Bill Lockyer, Attorney General, Robert R. Anderson, Chief Assistant Attorney General, Pamela C. Hamanaka, Senior Assistant Attorney General, Victoria B. Wilson, Supervising Deputy Attorney General, and Sharon E. Loughner, Deputy Attorney General, for Plaintiff and Respondent.
Certified for Partial Publication.[*]

OPINION ON REHEARING
GILBERT, P.J.
In this criminal action the magistrate granted defendant's motion to suppress evidence. (Pen.Code, § 1538.5.)[1] The prosecution successfully moved to reinstate the complaint pursuant to section 871.5. To challenge the validity of the search on appeal, must defendant first make a suppression motion before the superior court? No. Once the door has been shut on defendant, he is not required to knock again. He need not perform a useless act to preserve his right to appeal.
Peter Gutierrez appeals his conviction after a guilty plea to one count of possession of a controlled substance (Health & Saf.Code, § 11377, subd. (a)) and one count of forgery (§ 475, subd. (b)). Although Gutierrez may challenge the ruling on his search and seizure motion we conclude it was constitutionally valid and affirm.

[[/]][**]

DISCUSSION

I
The Attorney General contends that Gutierrez is procedurally barred from challenging the validity of the search and seizure.
The Attorney General does not contest that when the issue is properly preserved in the trial court, a defendant may seek review of the validity of the search and seizure on appeal from his conviction after a plea of guilty. (§ 1538.5, subd. (m).) The *928 Attorney General points out, however, that section 1538.5, subdivision (m), provides in part, "Review on appeal may be obtained by the defendant provided that at some stage of the proceedings prior to conviction he ... has moved for ... the suppression of the evidence." The Attorney General cites People v. Lilienthal (1978) 22 Cal.3d 891, 896-897, 150 Cal.Rptr. 910, 587 P.2d 706, for the proposition that to preserve the issue it is not enough to raise it at the preliminary hearing. Instead, the defendant must make a motion in superior court pursuant to section 1538.5 or 995. (People v. Lilienthal, at pp. 896-897, 150 Cal.Rptr. at pp. 912-913, 587 P.2d at pp. 708-709.)
It is true the only motion to suppress evidence that Gutierrez made here was before the magistrate. But the superior court considered the validity of the search in granting the prosecution's motion pursuant to section 871.5. It makes no sense to require defendant to make a motion in superior court when that court has already rejected defendant's arguments in granting the prosecution's section 871.5 motion.
Section 871.5, subdivision (g), recognizes the futility of requiring the defendant who has lost a section 871.5 motion to make a section 995 motion in superior court prior to seeking a review by writ. Section 871.5, subdivision (g), provides that a defendant who loses a motion pursuant to section 871.5 may waive further proceedings before the magistrate, consent to the filing of the information, and "adopt as a motion pursuant to Section 995, the record and proceedings of the motion taken pursuant to this section and the order issued pursuant thereto, and may seek review of the order in the manner prescribed in Section 999a [writ of prohibition]."
Similarly, the defendant who loses a section 871.5 motion need not perform the idle task of making a section 1538.5 or 995 motion in superior court in order to preserve the issue for appeal.
The Attorney General's reliance on Lilienthal is misplaced. There the prosecution did not make a section 871.5 motion. Thus the court did not consider whether the prosecution's section 871.5 motion is sufficient to preserve the issue for appeal. The court decided that raising the matter only at the preliminary hearing is not sufficient on the theory that "it would be wholly inappropriate to reverse a superior court's judgment for error it did not commit and that was never called to its attention. [Fn. omitted.]" (People v. Lilienthal, supra, 22 Cal.3d at p. 896, 150 Cal.Rptr. 910, 587 P.2d 706.) That rationale does not apply where, as here, the matter was considered by the superior court on the prosecution's section 871.5 motion.
Gutierrez is not procedurally barred from raising the validity of the search and seizure on appeal.

[[/]][***]
The judgment is affirmed.
We concur: COFFEE and PERREN, JJ.
NOTES
[*]   Pursuant to California Rules of Court, rules 976(b) and 976.1, this opinion is certified for partial publication. The portions of this opinion to be deleted from publication are identified as those portions between double brackets, e.g. [[/]].
[1]  All statutory references are to the Penal Code unless otherwise stated.
[**]   See footnote *, ante.
[***]   See footnote *, ante.
