Carnival's policy recommends that luggage be unlocked when you turn it over to the porter, but it is not mandatory. If you do lock it and they see something suspicious during the scanning process you will have to go to the security room on the ship and open any suspect bags in front of security for a manual check. They will not be delivered to your cabin.
I also think they randomly pull bags for a manual inspection since we had a piece which was checked last summer on the Elation and it had a letter inside saying they had opened the luggage (we didn't lock anything). I say random because that piece of luggage had only clothes in it, certainly nothing that might look unusual on an x-ray screen. No shoes, cords, appliances, booze, etc., just shirts, slacks, and underwear. But regardless we would have had to go through the hassle of going to the 'naughty room' as they sometimes call it.