The cop's actions may not have been illegal if he was executing a warrant on the apartment's other occupant and smelled something. That's for your lawyer to work on.