If the police smell marijuana coming from your home that gives them what is known as "probable cause" to believe there is criminal activity going on in your house.
Probable cause means that based upon the facts and circumstances known to the officer at that time, he would have information that allows a reasonable person to conclude a criminal act was under being committed or had been committed and that marijuana would be found within the house.
But the smell of an illegal substance alone is not enough to allow the police to just barge into your house. For them to enter your home without a search warrant must have something called "exigent circumstances."
So what exactly counts as exigent circumstances?
It basically means there's some sort of an emergency situation requiring swift action by the police to prevent imminent danger to life or serious damage to property or to forestall the imminent escape of a suspect, or destruction of evidence.
So if you just answer the door to the police and they say they smell weed, they can't just bust into your house without something more. Now they may say, "we smell weed we need to come in and look around." No, then they want to come in and look around but unless they can establish there is some sort of exigent circumstance they can't just walk into your house. If you feel like inviting them in so they can find your stash and arrest you, well that's up to you. They may tell you they're going to try to go get a search warrant and if they're successful in doing so they can come back with a warrant and search your house. Then again, they may not be able to get a search warrant.
In most cases, if the police come in without a search warrant, they're going to try to justify it in court by claiming there was some sort of emergency. For example, they may say they heard a bunch of noise that sounded like toilets flushing that led them to believe that someone was trying to destroy the evidence. They may claim they heard rapid footsteps like a suspect was trying to escape. If there's a dispute about whether or not the police legally entered your house, a judge would decide if the police were justified or not. Nowadays with body cams, at least, we have more of an opportunity to see what really went on.
Now there are times when the smell of some drugs can allow the police to come into your home without a search warrant, most notably, methamphetamine. That's because meth labs can and do blow up. In Alabama, the courts consider that the odor of a meth lab provides both probable cause and an emergency circumstance because of the risk of explosion and the immediate danger to people who may be near or exposed to a meth lab. But weed doesn't just blow up; so the police cant legally barge into your house just because of the smell of weed. The cops need to show that you either invited them in or there was some sort of emergency going on.